0
This repository has been archived on 2022-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
Files
ghast-tools/src/main/java/ghast/logger/LoggerAdapter.java
2021-10-07 01:03:50 +03:00

38 lines
1.3 KiB
Java

package ghast.logger;
public abstract class LoggerAdapter {
public abstract void debug(String message);
public abstract void debug(String message, Throwable throwable);
public abstract void info(String message);
public abstract void warn(String message);
public abstract void error(String message);
public abstract void error(String message, Throwable throwable);
public void debug(String pattern, Object... objects) {
FormattingPair formattingPair = LoggerFormatter.arrayFormat(pattern, objects);
if (formattingPair.getThrowable() != null) {
debug(formattingPair.getMessage(), formattingPair.getThrowable());
} else {
debug(formattingPair.getMessage());
}
}
public void info(String pattern, Object... objects) {
info(StringFormatter.arrayFormat(pattern, objects));
}
public void warn(String pattern, Object... objects) {
warn(StringFormatter.arrayFormat(pattern, objects));
}
public void error(String pattern, Object... objects) {
FormattingPair formattingPair = LoggerFormatter.arrayFormat(pattern, objects);
if (formattingPair.getThrowable() != null) {
error(formattingPair.getMessage(), formattingPair.getThrowable());
} else {
error(formattingPair.getMessage());
}
}
}