org.pmw.tinylog.Configurator Java Examples

The following examples show how to use org.pmw.tinylog.Configurator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Basics.java    From trackworktime with GNU General Public License v3.0 6 votes vote down vote up
private void init() {
	preferences = PreferenceManager.getDefaultSharedPreferences(context);
	dao = new DAO(context);
	timerManager = new TimerManager(dao, preferences, context);
	timeCalculator = new TimeCalculator(dao, timerManager);
	externalNotificationManager = new ExternalNotificationManager(context);

	// init TinyLog
	String threadToObserve = Thread.currentThread().getName();
	Configurator.defaultConfig()
		.writer(new RollingFileWriter(getDataDirectory().getAbsolutePath() + File.separatorChar + Constants.CURRENT_LOG_FILE_NAME,
				2, false, new CountLabeler(), new DailyPolicy()),
				Level.DEBUG, "{date:yyyy-MM-dd HH:mm:ss} {{level}|min-size=5} {class_name}.{method} - {message}")
		.addWriter(new LogcatWriter("trackworktime"), Level.DEBUG, "{message}")
		.writingThread(threadToObserve, 1)
		.activate();
	Logger.info("logger initialized - writing thread observes \"{}\"", threadToObserve);

	registerThirdPartyReceiver();
}