[DEV] update log interface
This commit is contained in:
parent
7e7bf02598
commit
5e0fdf1bc8
@ -52,7 +52,6 @@ public class Ejson {
|
|||||||
final byte[] elemData = Uri.getAllData(data);
|
final byte[] elemData = Uri.getAllData(data);
|
||||||
if (elemData == null) {
|
if (elemData == null) {
|
||||||
Log.error("Can not read the Stream : " + data);
|
Log.error("Can not read the Stream : " + data);
|
||||||
Log.displayBackTrace();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final String dataToParse = new String(elemData);
|
final String dataToParse = new String(elemData);
|
||||||
|
@ -9,6 +9,7 @@ import io.scenarium.logger.LogLevel;
|
|||||||
import io.scenarium.logger.Logger;
|
import io.scenarium.logger.Logger;
|
||||||
|
|
||||||
public class Log {
|
public class Log {
|
||||||
|
private static final boolean FORCE_ALL = false;
|
||||||
private static final String LIB_NAME = "ejson";
|
private static final String LIB_NAME = "ejson";
|
||||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME);
|
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME);
|
||||||
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL);
|
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL);
|
||||||
@ -20,62 +21,58 @@ public class Log {
|
|||||||
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
|
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
|
||||||
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
|
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
|
||||||
|
|
||||||
public static void critical(final String data) {
|
public static void critical(final Exception e, final String data) {
|
||||||
if (Log.PRINT_CRITICAL) {
|
|
||||||
Logger.critical(Log.LIB_NAME_DRAW, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void critical(final String data, final Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if (Log.PRINT_CRITICAL) {
|
if (PRINT_CRITICAL || FORCE_ALL) {
|
||||||
Logger.critical(Log.LIB_NAME_DRAW, data + " : " + e.getMessage());
|
Logger.critical(LIB_NAME_DRAW, data + " : " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debug(final String data) {
|
public static void critical(final String data, final Object... objects) {
|
||||||
if (Log.PRINT_DEBUG) {
|
if (PRINT_CRITICAL || FORCE_ALL) {
|
||||||
Logger.debug(Log.LIB_NAME_DRAW, data);
|
Logger.critical(LIB_NAME_DRAW, data, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void displayBackTrace() {
|
public static void debug(final String data, final Object... objects) {
|
||||||
Logger.displayBackTrace(Log.LIB_NAME_DRAW);
|
if (PRINT_DEBUG || FORCE_ALL) {
|
||||||
}
|
Logger.debug(LIB_NAME_DRAW, data, objects);
|
||||||
|
|
||||||
public static void error(final String data) {
|
|
||||||
if (Log.PRINT_ERROR) {
|
|
||||||
Logger.error(Log.LIB_NAME_DRAW, data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(final String data) {
|
public static void error(final String data, final Object... objects) {
|
||||||
if (Log.PRINT_INFO) {
|
if (PRINT_ERROR || FORCE_ALL) {
|
||||||
Logger.info(Log.LIB_NAME_DRAW, data);
|
Logger.error(LIB_NAME_DRAW, data, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void print(final String data) {
|
public static void info(final String data, final Object... objects) {
|
||||||
if (Log.PRINT_PRINT) {
|
if (PRINT_INFO || FORCE_ALL) {
|
||||||
Logger.print(Log.LIB_NAME_DRAW, data);
|
Logger.info(LIB_NAME_DRAW, data, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void todo(final String data) {
|
public static void print(final String data, final Object... objects) {
|
||||||
if (Log.PRINT_TODO) {
|
if (PRINT_PRINT || FORCE_ALL) {
|
||||||
Logger.todo(Log.LIB_NAME_DRAW, data);
|
Logger.print(LIB_NAME_DRAW, data, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verbose(final String data) {
|
public static void todo(final String data, final Object... objects) {
|
||||||
if (Log.PRINT_VERBOSE) {
|
if (PRINT_TODO || FORCE_ALL) {
|
||||||
Logger.verbose(Log.LIB_NAME_DRAW, data);
|
Logger.todo(LIB_NAME_DRAW, data, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warning(final String data) {
|
public static void verbose(final String data, final Object... objects) {
|
||||||
if (Log.PRINT_WARNING) {
|
if (PRINT_VERBOSE || FORCE_ALL) {
|
||||||
Logger.warning(Log.LIB_NAME_DRAW, data);
|
Logger.verbose(LIB_NAME_DRAW, data, objects);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void warning(final String data, final Object... objects) {
|
||||||
|
if (PRINT_WARNING || FORCE_ALL) {
|
||||||
|
Logger.warning(LIB_NAME_DRAW, data, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user