mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-24 17:47:38 +01:00
update ConsoleLogger
This commit is contained in:
parent
e3166c6807
commit
4cbd8aad31
@ -1,5 +1,9 @@
|
||||
package fr.xephi.authme;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import fr.xephi.authme.api.NewAPI;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
@ -8,39 +12,30 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
|
||||
import fr.xephi.authme.api.NewAPI;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class ConsoleLogger {
|
||||
|
||||
private static final Logger log = AuthMe.getInstance().getLogger();
|
||||
private static final DateFormat df = new SimpleDateFormat("[MM-dd HH:mm:ss]");
|
||||
|
||||
public static void info(String message) {
|
||||
if (AuthMe.getInstance().isEnabled()) {
|
||||
log.info("[AuthMe] " + message);
|
||||
if (Settings.useLogging) {
|
||||
String dateTime;
|
||||
synchronized (df) {
|
||||
dateTime = df.format(new Date());
|
||||
}
|
||||
writeLog(dateTime + " " + message);
|
||||
log.info("[AuthMe] " + message);
|
||||
if (Settings.useLogging) {
|
||||
String dateTime;
|
||||
synchronized (df) {
|
||||
dateTime = df.format(new Date());
|
||||
}
|
||||
writeLog(dateTime + " " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showError(String message) {
|
||||
if (AuthMe.getInstance().isEnabled()) {
|
||||
log.warning("[AuthMe] " + message);
|
||||
if (Settings.useLogging) {
|
||||
String dateTime;
|
||||
synchronized (df) {
|
||||
dateTime = df.format(new Date());
|
||||
}
|
||||
writeLog(dateTime + " ERROR: " + message);
|
||||
log.warning("[AuthMe] " + message);
|
||||
if (Settings.useLogging) {
|
||||
String dateTime;
|
||||
synchronized (df) {
|
||||
dateTime = df.format(new Date());
|
||||
}
|
||||
writeLog(dateTime + " ERROR: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,10 +49,12 @@ public class ConsoleLogger {
|
||||
}
|
||||
|
||||
public static void writeStackTrace(Exception ex) {
|
||||
String dateTime;
|
||||
synchronized (df) {
|
||||
dateTime = df.format(new Date());
|
||||
if (Settings.useLogging) {
|
||||
String dateTime;
|
||||
synchronized (df) {
|
||||
dateTime = df.format(new Date());
|
||||
}
|
||||
writeLog(dateTime + " " + Throwables.getStackTraceAsString(ex));
|
||||
}
|
||||
writeLog(dateTime + " " + Throwables.getStackTraceAsString(ex));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user