[DEV] update log interface

This commit is contained in:
Edouard DUPIN 2022-04-01 00:58:28 +02:00
parent 26f130ffd5
commit 7628561fb6
2 changed files with 39 additions and 29 deletions

View File

@ -4,14 +4,16 @@
open module sample.atriasoft.ege { open module sample.atriasoft.ege {
exports sample.atriasoft.ege.mapFactory; exports sample.atriasoft.ege.mapFactory;
exports sample.atriasoft.ege.mapFactory.model;
exports sample.atriasoft.ege.mapFactory.tools;
exports sample.atriasoft.ege.collisiontest; exports sample.atriasoft.ege.collisiontest;
exports sample.atriasoft.ege.lowPoly; exports sample.atriasoft.ege.lowPoly;
exports sample.atriasoft.ege.loxelEngine; exports sample.atriasoft.ege.loxelEngine;
exports sample.atriasoft.ege.oldTest; exports sample.atriasoft.ege.oldTest;
exports sample.atriasoft.ege.s1_texturedCube; exports sample.atriasoft.ege.s1_texturedCube;
requires org.atriasoft.ege; requires transitive org.atriasoft.ege;
requires org.atriasoft.ewol; requires transitive org.atriasoft.ewol;
requires org.atriasoft.etk; requires transitive org.atriasoft.etk;
requires org.atriasoft.gale; // for map factory requires transitive org.atriasoft.gale; // for map factory
} }

View File

@ -4,6 +4,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 = "ege"; private static final String LIB_NAME = "ege";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME); private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL); private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
@ -15,51 +16,58 @@ public class Log {
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO); private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT); private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
public static void critical(final String data) { public static void critical(final Exception e, final String data) {
if (PRINT_CRITICAL) { e.printStackTrace();
Logger.critical(LIB_NAME_DRAW, data); if (PRINT_CRITICAL || FORCE_ALL) {
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 (PRINT_DEBUG) { if (PRINT_CRITICAL || FORCE_ALL) {
Logger.debug(LIB_NAME_DRAW, data); Logger.critical(LIB_NAME_DRAW, data, objects);
} }
} }
public static void error(final String data) { public static void debug(final String data, final Object... objects) {
if (PRINT_ERROR) { if (PRINT_DEBUG || FORCE_ALL) {
Logger.error(LIB_NAME_DRAW, data); Logger.debug(LIB_NAME_DRAW, data, objects);
} }
} }
public static void info(final String data) { public static void error(final String data, final Object... objects) {
if (PRINT_INFO) { if (PRINT_ERROR || FORCE_ALL) {
Logger.info(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 (PRINT_PRINT) { if (PRINT_INFO || FORCE_ALL) {
Logger.print(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 (PRINT_TODO) { if (PRINT_PRINT || FORCE_ALL) {
Logger.todo(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 (PRINT_VERBOSE) { if (PRINT_TODO || FORCE_ALL) {
Logger.verbose(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 (PRINT_WARNING) { if (PRINT_VERBOSE || FORCE_ALL) {
Logger.warning(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);
} }
} }