https://github.com/unfoldingword-dev/android-logger
A better logging tool for android
https://github.com/unfoldingword-dev/android-logger
Last synced: 2 months ago
JSON representation
A better logging tool for android
- Host: GitHub
- URL: https://github.com/unfoldingword-dev/android-logger
- Owner: unfoldingWord-dev
- License: mit
- Created: 2016-02-27T01:14:33.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-19T22:57:41.000Z (about 9 years ago)
- Last Synced: 2025-01-19T21:16:10.649Z (over 1 year ago)
- Language: Java
- Size: 110 KB
- Stars: 0
- Watchers: 7
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Logger
An advanced logging library that provides support for writing logs to a file and catching global application exceptions.
##Installation
To use this library your Android project must be configured to use the JCenter or Maven Central repositories.
Add the following to your package dependencies and sync gradle.
```
compile 'org.unfoldingword.tools:logger:1.0.0'
```
##Set up Global Exception Handler
If you want to use the global exception handler then you should register it when your app starts.
```
Logger.registerGlobalExceptionHandler(pathToStacktraceDirectory);
```
The argument is the directory path where you want stacktraces to be stored.
##Set up Logger
The logger contains three levels of log detail
* Info
* Warning
* Error
To begin using the logger you must configure it
```
Logger.configure(pathToLogFile, minimumAllowdLogLevel);
```
The first argument gives the path to the log file that will be written to. The second argument is the lower log level that will be processed.
##Usage
The Logger is a singleton so to use it you simply call one of it's static log methods
```
Logger.e(tag, message, throwable);
Logger.w(tag, message, throwable);
Logger.w(tag, message);
Logger.i(tag, message);
```
There are other public methods that allow you to retrieve a list of log objects, flush the log, or list stacktrace files.
```
List logsEntries = logsEntries =