MG Log - mrkcsc/android-mg-bootstrap GitHub Wiki
MG Log
A simple logging wrapper over Timber (https://github.com/JakeWharton/timber). Use this to more easily log messages with a standard tag across projects. By default it also filters out any log statement in production, or you can configure custom behavior in this enviornment.
Configuration
- Initialize the logger in your application class.
class App extends Application {
public void onCreate() {
super.onCreate();
MGLog.getConfig().init(this);
}
}
- Optionally set production error and info actions (in Debug enviornment, messages are logged to console).
MGLog.getConfig().setError((throwable, s, objects) -> { });
MGLog.getConfig().setInfo ((throwable, s, objects) -> { });
Usage
- Log anything and everything to your liking!
MGLog.e("Here is a message");
MGLog.e("Here is a message with parameters: %d, %d", param1, param2);
MGLog.e("Here is a message" + " with more string.");
MGLog.e("Here is a message that logs at info level.");