Giter Site home page Giter Site logo

android-applog's Introduction

Android-AppLog

AppLog is a simple Android logger that gives you a detailed output and more log options.

How it works

AppLog works as a wrapper around android.util.Log and allows detailed logging by traversing through the Stack and printing class/method/linenumber, nicer output with String.format support, more loggable types by using Object.toString and the possibility to mute logging with setMute.

Implementation

AppLog:

Just import and call AppLog, it will resolve method and class invoking the trace and accept primary types by invoking Object.toString

import se.marteinn.utils.AppLog;

AppLog.i("Hello World"); 	// output: Hello World (method:99)
AppLog.i(3.14159265359):	// output: 3.14159265359 (method:99)
AppLog.i(1.5); 				// output: 1.5 	(method:99)
AppLog.i(true); 			// output: true	(method:99)
AppLog.i(1);  				// output: 1	(method:99)

You can also supply a tag variable, as you would with regular logging.

AppLog.i(TAG, "Hello World"); 	// output: Hello World

It is also possible to log with String.format syntax using LogFormat.

import se.marteinn.utils.AppLog;
import se.marteinn.utils.LogFormat;

AppLog.i(new LogFormat("name=%s"), "martin");					// output: name=martin
AppLog.i(new LogFormat("name=%s, month=%d"), "martin", 1);		// output: name=martin, month=1
AppLog.i(new LogFormat("date=%tD"), new Date());				// output: date=05/18/14

You can also disable logging:

AppLog.setMute(true);
AppLog.i(TAG, 1);				// output: .... *crickets.

Or remove namespace from class when using class resolve.

AppLog.i(1);				// se.marteinn.YourClass	1 (method:99)

AppLog.setSkipNamespace(true);
AppLog.i(1);				// YourClass				1 (method:99)

Setup

Maven

You can import AppLog with Gradle through maven:

dependencies {
	compile 'se.marteinn.utils.logging:applog:2.1.2'
}

Locally

Download applog.aar and move it to your libs folder, then make sure you got libs specified as a flatDir in gradle.config

repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}

After that just include it as any other dependency.

dependencies {
	compile 'se.marteinn.utils.logging:applog:2.1.2@aar'
}

Or you could just use the applog.jar, move it to libs and include it with files().

dependencies {
	compile files('libs/applog.jar')
}

Contributing

Want to contribute? Awesome. Just send a pull request.

This project is setup as a Android Library for Android Studio. Use gradlew to build.

License

Android-AppLog is released under the MIT License.

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.