Android Logger

Simple Log Wrapper over android.util.Log class

Лицензия

Лицензия

Группа

Группа

com.github.michelzanini
Идентификатор

Идентификатор

android-logger
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Android Logger
Simple Log Wrapper over android.util.Log class
Ссылка на сайт

Ссылка на сайт

https://github.com/michelzanini/android-logger
Система контроля версий

Система контроля версий

https://github.com/michelzanini/android-logger

Скачать android-logger

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.michelzanini/android-logger/ -->
<dependency>
    <groupId>com.github.michelzanini</groupId>
    <artifactId>android-logger</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.michelzanini/android-logger/
implementation 'com.github.michelzanini:android-logger:1.0.1'
// https://jarcasting.com/artifacts/com.github.michelzanini/android-logger/
implementation ("com.github.michelzanini:android-logger:1.0.1")
'com.github.michelzanini:android-logger:jar:1.0.1'
<dependency org="com.github.michelzanini" name="android-logger" rev="1.0.1">
  <artifact name="android-logger" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.michelzanini', module='android-logger', version='1.0.1')
)
libraryDependencies += "com.github.michelzanini" % "android-logger" % "1.0.1"
[com.github.michelzanini/android-logger "1.0.1"]

Зависимости

provided (1)

Идентификатор библиотеки Тип Версия
com.google.android : android jar 4.0.1.2

Модули Проекта

Данный проект не имеет модулей.

Android Logger

View the project's web site here.

It is hard to work with log levels when using android.util.Log class.
The methods are short and not very readable, like Log.d, Log.e, etc... There aren`t many options to format the log.
Also, there are a few bugs, like logging a null String will crash the app.

This project is a simple wrapper above the android.util.Log class. It is similar to Apache Commons Logging, as many may be used to. The log levels available are: verbose, debug, info, warn and error.

This is an example of how to obtain a Logger instance:

//using a String as Log Tag
Logger logger = LoggerFactory.getLogger("LOG_TAG");

//using a class name as Log Tag
Logger logger = LoggerFactory.getLogger(getClass());

These are some of the log methods available:

//logging a String message
logger.debug("String message");

//logging a String using arguments to format the string (message and params are used with String.format())
logger.info("String with params: Param 1 = %s, Param 2 = %s", "Param 1 Value", "Param 2 Value");

//logging a Exception
logger.error(e);

//logging a message and a Exception
logger.error("Message", e);

How to set the desired log level for logging (default is Level.INFO):

//log level constant from code
LoggerFactory.setLevel(LoggerLevel.DEBUG);

//log level constant from strings.xml
LoggerFactory.setLevelFromStringResource(context, R.string.log_level);

/*
in the 'strings.xml' file
<string name="log_level">DEBUG</string>
*/

How to filter log messages that can impact performance:

if (logger.isDebugEnabled()) {
   logger.debug("Message " + variable + " something else...");
}

How to get it

Download the bundle or add it as a Maven dependency:

<dependency>
   <groupId>com.github.michelzanini</groupId>
   <artifactId>android-logger</artifactId>
   <version>1.0.1</version>
</dependency>

Версии библиотеки

Версия
1.0.1
1.0.0