All Projects → MFlisar → Lumberjack

MFlisar / Lumberjack

Licence: Apache-2.0 license
Lumberjack - a customisable and extensible file/console logger for Timber

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Lumberjack

Timber Ruby
🌲 Great Ruby logging made easy.
Stars: ✭ 154 (+381.25%)
Mutual labels:  timber
branch
Branch Starter Theme - A WordPress starter theme based on Timber library and Bootstrap
Stars: ✭ 87 (+171.88%)
Mutual labels:  timber
19h47.fr
🔥
Stars: ✭ 25 (-21.87%)
Mutual labels:  timber
Timber Elixir
🌲 Great Elixir logging made easy
Stars: ✭ 226 (+606.25%)
Mutual labels:  timber
slf4j-timber
SLF4J binding for Timber - a logger with a small, extensible API which provides utility on top of Android's normal Log class.
Stars: ✭ 20 (-37.5%)
Mutual labels:  timber
slf4j-timber
SLF4J binding for Jake Wharton's Timber Android logging library
Stars: ✭ 44 (+37.5%)
Mutual labels:  timber
Base Camp
Awesome WordPress starter theme for developers based on modern web technologies.
Stars: ✭ 135 (+321.88%)
Mutual labels:  timber
BakingApp
Udacity Android Developer Nanodegree, project 2.
Stars: ✭ 54 (+68.75%)
Mutual labels:  timber
Android-Starter-Kit
This is up-to-date android studio project for native android application, that is using modern tools and libraries.
Stars: ✭ 16 (-50%)
Mutual labels:  timber
ResDelivery-Hilt-Coroutines-Mvvm-Single-Activity
This is a Sample Single Activity App (Multi Fragments) that uses Dagger-Hilt, Coroutines Flows, Paging 3 & Mvvm Clean Architecture
Stars: ✭ 28 (-12.5%)
Mutual labels:  timber
Marvel
Marvel Characters Android Application Assigned by smava GmbH
Stars: ✭ 227 (+609.38%)
Mutual labels:  timber
Next Go
Production ready blog + boilerplate for Next.js 3.X
Stars: ✭ 254 (+693.75%)
Mutual labels:  timber
next-go
Production ready blog + boilerplate for Next.js 3.X
Stars: ✭ 255 (+696.88%)
Mutual labels:  timber
Logger
✔️ Simple, pretty and powerful logger for android
Stars: ✭ 13,093 (+40815.63%)
Mutual labels:  timber
InstantAppStarter
Starter Project Structure for Android Instant app. https://blog.mindorks.com/android-mvp-architecture-with-instant-app-support-11ba48241a82
Stars: ✭ 44 (+37.5%)
Mutual labels:  timber
Timmy
Advanced image handling for Timber.
Stars: ✭ 146 (+356.25%)
Mutual labels:  timber
pine
pine - A CLI installer for timber
Stars: ✭ 29 (-9.37%)
Mutual labels:  timber
Multiplatform-Log
Kotlin Multi Platform Logger, for android an ios : Logcat & print
Stars: ✭ 49 (+53.13%)
Mutual labels:  timber
timber-junit-rule
A highly configurable JUnit Rule that outputs Timber logs to standard output
Stars: ✭ 42 (+31.25%)
Mutual labels:  timber
Instant-Weather
An Android weather application implemented using the MVVM pattern, Retrofit2, Dagger Hilt, LiveData, ViewModel, Coroutines, Room, Navigation Components, Data Binding and some other libraries from the Android Jetpack.
Stars: ✭ 677 (+2015.63%)
Mutual labels:  timber

Lumberjack Release

What does it do?

A simple logger for JackWhartons Timber logging library with following features:

  • trees for:
    • logging to console (with the ability to add clickable links to the calling line in the calling class)
    • files (one file per day, select between numbered log file names or date based log file names)
  • customise each tree to whatever you want or extend them or add your own tree
  • little utility class to log time and laps (the T class)
  • by default, this library will create tags if no custom tag is provided like "[CLASSNAME:LINE] FUNCTION" e.g. [MainActivity:32 onCreate]: Some log
  • feedback module that contains extension functions for L to send feedback or to show a notification that will send a feedback on click:
    • L.sendFeedback()... sends a feedback via IntentChooser with an optional files appended
  • notification module that contains functions to show info/error notifications
  • viewer module that contains an activity to show a log file with filter functions

All features are splitted into separate modules, just include the modules you want to use!

Gradle (via JitPack.io)

  1. add jitpack to your project's build.gradle:
repositories {
    maven { url "https://jitpack.io" }
}
  1. add the compile statement to your module's build.gradle:
dependencies {
    // base module (NECESSARY)
	implementation 'com.github.MFlisar.Lumberjack:lumberjack-library:<LATEST-VERSION>'
    // modules (OPTIONAL)
    implementation 'com.github.MFlisar.Lumberjack:lumberjack-filelogger:<LATEST-VERSION>'
    implementation 'com.github.MFlisar.Lumberjack:lumberjack-feedback:<LATEST-VERSION>'
    implementation 'com.github.MFlisar.Lumberjack:lumberjack-notification:<LATEST-VERSION>'
    implementation 'com.github.MFlisar.Lumberjack:lumberjack-viewer:<LATEST-VERSION>'

    // Wrapper for java => will provide a class `L2` with all the functions from `L` but without the inlining feature because this is not possible in java
    // can be used to use Lumberjack in mixed java and kotlin projects
	// of course you can always use the lambda functions in java as well, but the L2 calls are shorter:
	// JAVA Code: L2.d("Test") vs. L.INSTANCE.d(() -> "Test")
    // implementation 'com.github.MFlisar.Lumberjack:lumberjack-java-wrapper:<LATEST-VERSION>'
}

Usage

Once in your app do following:

// simply console logger
L.plant(ConsoleTree())

// if desired, disable all logging in release
// L.enabled = Build.DEBUG
Module filelogger
// a file logger (optional)
// here you can setup a date file or a number file file logger - all variables like folder, filename, extension, file to keep and so on can be customised
// when creating the setup
// following default setup keeps log files for 7 days and creates a new file each day and names them "log_YYYYmmdd.log" by default
val fileLoggingSetup = FileLoggingSetup.DateFiles(context) 
L.plant(FileLoggingTree(fileLoggingSetup))
Module feedback
// send feedback with the log file appended (chooser to select a mail will be opened, no internet permission needed!)
// mail receiver is optional, it defaults to the lumberjack_mail_receiver resource string so its fine if you instead of providing the mail address here
// you simply set the resource string to your mail address instead
L.sendFeedback(context, fileLoggingSetup, "[email protected]")
Module notification
// show a crash notifcation - on notification click the user can send a feedback mail including the log file
L.showCrashNotification(context, logFile /* may be null */, "[email protected]", R.mipmap.ic_launcher, "NotificationChannelID", 1234 /* notification id */)

// show a notification to allow the user the report some interesting internal proplems
L.showCrashNotification(context, fileLoggingSetup, "[email protected]", R.mipmap.ic_launcher, "NotificationChannelID", 1234 /* notification id */)

// show an information notification to the user (or for dev purposes)
L.showInfoNotification(context, "NotificationChannelID", 1234 /* notification id */, "Notification Title", "Notification Text", R.mipmap.ic_launcher)

// as above, but on notification click it will open the log viewer showing the provided log file
L.showInfoNotification(context, logFile, "NotificationChannelID", 1234 /* notification id */, "Notification Title", "Notification Text", R.mipmap.ic_launcher)
Module viewer
// show the log viewer activity (mail address is optional, if it's null, the send mail entry will be removed from the viewers menu)
L.showLog(context, fileLoggingSetup, "[email protected]")

Viewer

Check out the demo to see more

Example - LOGGING

The logger is simply used like following:

// this simply logs a message
L.d { "Simpe log" }
// simply log with custom tag
L.tag("CUSTOM-TAG").d { "Some message with a tag" }
// Log and only run log code based on a function / boolean flag
L.logIf { true }?.d { "Is logged, as flag is true" }
L.logIf { someFunction() }?.d { "Is logged and only executed if someFunction returns true" }

If used with logIf the expression is only executed if logIf returns true so it's save to keep all the logging lines in production code.

Example - OUTPUT

[MainActivity:26 onCreate]: Main activity created (MainActivity.kt:26)
[MainActivity:27 onCreate]: Test message - count: 0 (MainActivity.kt:27)
[MainActivity:28 onCreate]: Test error (MainActivity.kt:28)
    java.lang.Throwable: ERROR
        at com.michaelflisar.lumberjack.demo.MainActivity.onCreate(MainActivity.kt:28)
        at android.app.Activity.performCreate(Activity.java:7183)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6938)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].