Code Monkey home page Code Monkey logo

unified-logger's Introduction

Unified Logger

A logging framework that wraps around Timber and Crashlytics (Fabric.io)

Download

  • ###If you are including including the library off jCenter:
    repositories {
        jcenter()
    }
    ...
    compile(group: 'unified-logger-public', name: 'unified-logger', version: 'versionNumber', ext: 'aar') {
        transitive = true;
    }
  • ###If you want to include the library locally:
  • Download the aar from GitHub, or clone the project and build it yourself
  • Copy the aar into your project, for example the 'libs' folder
  • Add the folder (that you copied the aar into) in your repositories. For example, if you have added Fabric.io to your project and copied the aar in libs it would look like:
repositories {
    maven { url 'https://maven.fabric.io/public' }
    flatDir {
        dirs 'libs'
    }
}
  • Add the dependency itself:
compile name: 'unified-logger', ext: 'aar'
  • Add the dependencies of the library:
    compile 'com.jakewharton.timber:timber:4.3.0'

##Permissions

  • Unified-Logger does not ask for any permissions by itself.
  • Crashlytics requires the INTERNET permission to be able to upload reports, and it will automatically add it to the project during the auto-configuration of the project.
  • WRITE_EXTERNAL_STORAGE would be needed if you wanted to write logs on the SD card, like the demo application does.

Configuration

  • Fabric.io has to be added to the project, as every project must acquire it's own unique API key for Crashlytics to work. This can be done easily via the Fabric.io Android Studio plugin.

Usage

Usage is very similar to how you'd use SLF4J, while the API is mirrored from android's own logger.

  • Instantiate the logger for each class in a private static final field as such:
private static final UnifiedLogger LOG = UnifiedLogger.getUnifiedLogger(YourClass.class);
  • Use it freely
LOG.d(TAG, "your message", true);

This will log a message at the DEBUG priority level into both LogCat and Crashlytics. Logs that were passed into Crashlytics (with true) will accompany the crash report that you get on the site, if there's been a crash.

unified-logger's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.