jodamoblog

General

Category
Free
Tag
Logging
License
MIT License
Registered
Jan 12, 2015
Favorites
0
Link
https://github.com/dpreussler/jodamoblog
See also
NotificationLog
ActivityFrameMetrics
XLog
KLog
log

Additional

Language
Java
Version
1.2.4 (Oct 21, 2015)
Created
Oct 15, 2014
Updated
Jan 21, 2016 (Retired)
Owner
Danny Preussler (dpreussler)
Contributor
Danny Preussler (dpreussler)
1
Activity
Badge
Generate
Download
Source code

jodamoblog

Just another logging framework

multiple combinable logging classes. Combine local logging with rolling file logging with Crashlytcs with NewRelic...

Gradle

compile 'de.jodamob.android:jodamoblog:1.2.4'
 

Usage

LogCatLogger : writes to android.util.log

FileLogger : writes rotating log files with java.util.logging (get content written via FileLogger.getLogFileContent() if needed)

SilentLogger: does not log (implements same interface as above, can be used to disable logging)

AsyncLogger : moves all logging into background thread (might be useful in combination with FileLogger)

UncaughtExceptionLogger: registers as exception handler in system and reports those exceptions to logfile

CrashlyticsLogger: sends exceptions that where logged to crashlytics as caught crash)

NewRelicLogger: sends exceptions that where logged to NewRelic as Network errors (there is no better way for now in API)

Log : has the same "interface" as android.util.Log so that only the package has to be changed with one additional initializer method: Log.initLogger() excepts any of the loggers above

example:

Log.initLogger(new LogCatLogger()) writes to console (default)

Log.initLogger(new FileLogger(context, new LogCatLogger())) writes to files + console

Log.initLogger(new UncaughtExceptionLogger(new FileLogger(context))) writes logs and uncaught crashes to file

Log.initLogger(new AsyncLogger(new FileLogger(new CrashlyticsLogger(new LogCatLogger())))); writes async to file and crashlytics and logcat

Log.initLogger(new SilentLogger()) disables logging

Or simply create the UberLog:

Log.initLogger(
            new NewRelicLogger(
                    new CrashlyticsLogger(
                            new LogCatLogger(
                                    new UncaughtExceptionLogger(
                                            new AsyncLogger(
                                                    new FileLogger(context)))))));

Small helpers

check out helper classes

StreamUtils.copy(inputstream, outputstream)

Closeables.closeQuietly(stream1, stream2,...)

Licensed under MIT license (c) 2014 Danny Preussler