A loggin framework for use in Android application. It allows you to log error, warrning and information easily to the console, just like you would have with Log.e or Log.i or Log.d, but in easy way.It automatically add key param so you only need to pass the message you want to display.
1. To log an error
- Instead of
Log.e(“LOGLIBRARY”,”Print Error”);
just writeLogLib.logError("Print Error");
2. To log a debug message
- Instead of
Log.d(“LOGLIBRARY”,”Print Debug Message”);
just writeLogLib.logDebug("Print Debug Message");
3. To log an info message
- Instead of
Log.i(“LOGLIBRARY”,”Print Info Message”);
just writeLogLib.logInfo("Print Info Message");
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.dipen-apptrait:LOGLIBRARY:0.1.0'
}
-
Create a new Android Studio Project called Log Demo
-
You need to add following gradle dependencies in yours
project/build.gradle
(Root gradle file):
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
- Add following gradle dependencies in yours
app/build.gradle
:
dependencies {
compile 'com.github.dipen-apptrait:LOGLIBRARY:0.1.0'
}
- Now open your activity
-
To log an error write
LogLib.logError("This is an Error");
-
To log an info message
LogLib.logInfo("This is an Info Message");
-
To log a debug message
LogLib.logDebug("This is a Debug Message");
-
Build and Run application
-
Open Logcat window and you can see a log messages as attached.
With the ranking as Top Mobile App Development Company in India, hire our skilled android app developer on Hourly | Part-time | Full-time basis. We will help you to develop an innovative android app as per requirements, budget & time limit.