#605 Logger - name methods after their log level
- Remove separate print stacktrace method - Log level into the log similar to console output
This commit is contained in:
@@ -59,7 +59,7 @@ public final class ConsoleLogger {
|
||||
public static void info(String message) {
|
||||
logger.info(message);
|
||||
if (useLogging) {
|
||||
writeLog(message);
|
||||
writeLog("[INFO] " + message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -69,10 +69,10 @@ public final class ConsoleLogger {
|
||||
*
|
||||
* @param message String
|
||||
*/
|
||||
public static void showError(String message) {
|
||||
public static void warning(String message) {
|
||||
logger.warning(message);
|
||||
if (useLogging) {
|
||||
writeLog("ERROR: " + message);
|
||||
writeLog("[WARN] " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,17 +96,6 @@ public final class ConsoleLogger {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a StackTrace into the log.
|
||||
*
|
||||
* @param th The Throwable whose stack trace should be logged
|
||||
*/
|
||||
public static void writeStackTrace(Throwable th) {
|
||||
if (useLogging) {
|
||||
writeLog(Throwables.getStackTraceAsString(th));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a Throwable with the provided message and saves the stack trace to the log file.
|
||||
*
|
||||
@@ -114,8 +103,10 @@ public final class ConsoleLogger {
|
||||
* @param th The Throwable to log
|
||||
*/
|
||||
public static void logException(String message, Throwable th) {
|
||||
showError(message + " " + StringUtils.formatException(th));
|
||||
writeStackTrace(th);
|
||||
warning(message + " " + StringUtils.formatException(th));
|
||||
if (useLogging) {
|
||||
writeLog(Throwables.getStackTraceAsString(th));
|
||||
}
|
||||
}
|
||||
|
||||
public static void close() {
|
||||
|
||||
Reference in New Issue
Block a user