Last active
August 29, 2015 14:09
-
-
Save ramuta/61a613b1ad07b7171806 to your computer and use it in GitHub Desktop.
Logga - the most gangsta Android logger :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package your.package.name; | |
import android.util.Log; | |
/* | |
* Copyright (C) 2014 Matej Ramuta | |
* | |
* Logga - the most gangsta Android logger :) | |
* | |
* For more info and instructions see a README here: https://github.com/ramuta/logga/blob/master/README.md | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
public class Logga { | |
private static final boolean DEBUGGA = true; | |
public static void i(final String message) { | |
if(DEBUGGA) { | |
final String fullClassName = Thread.currentThread().getStackTrace()[3].getClassName(); | |
final String className = fullClassName.substring(fullClassName.lastIndexOf(".") + 1); | |
final int lineNumba = Thread.currentThread().getStackTrace()[3].getLineNumber(); | |
Log.i(className, "#" + lineNumba + " " + message); | |
} | |
} | |
public static void e(final String message) { | |
if(DEBUGGA) { | |
final String fullClassName = Thread.currentThread().getStackTrace()[3].getClassName(); | |
final String className = fullClassName.substring(fullClassName.lastIndexOf(".") + 1); | |
final int lineNumba = Thread.currentThread().getStackTrace()[3].getLineNumber(); | |
Log.e(className, "#" + lineNumba + " ERRA!!1 " + message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment