Back to project page playnomics-android.
The source code is released under:
Apache License
If you think the Android project playnomics-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.playnomics.android.util; //from w w w .j a va 2s .co m public class Logger { public enum LogLevel { VERBOSE(0), DEBUG(1), WARNING(2), ERROR(3), NONE(4); private int level; LogLevel(int level) { this.level = level; } public int level() { return level; } } private LogLevel logLevel = LogLevel.ERROR; public void setLogLevel(LogLevel level) { this.logLevel = level; } private LogWriter logWriter; public Logger(LogWriter logWriter) { this.logWriter = logWriter; } public void log(LogLevel logLevel, String format, Object... args) { int authorizedLogLevel = this.logLevel.level(); int targetLogLevel = logLevel.level(); if (authorizedLogLevel <= targetLogLevel) { // can log the the message logWriter.writeLog(logLevel, format, args); } } public void log(LogLevel logLevel, Exception ex) { int authorizedLogLevel = this.logLevel.level(); int targetLogLevel = logLevel.level(); if (authorizedLogLevel <= targetLogLevel) { // can log the the message logWriter.writeLog(logLevel, ex); } } public void log(LogLevel logLevel, Exception ex, String message, Object... args) { int authorizedLogLevel = this.logLevel.level(); int targetLogLevel = logLevel.level(); if (authorizedLogLevel <= targetLogLevel) { // can log the the message logWriter.writeLog(logLevel, message, args); logWriter.writeLog(logLevel, ex); } } }