use of java.lang.System.Logger.Level in project Bytecoder by mirkosertic.
the class AbstractLoggerWrapper method logp.
@Override
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, Throwable thrown, Supplier<String> msgSupplier) {
final PlatformLogger.Bridge platformProxy = platformProxy();
if (platformProxy == null) {
// best effort
if (sourceClass == null && sourceMethod == null) {
wrapped().log(level.systemLevel(), msgSupplier, thrown);
} else {
Level systemLevel = level.systemLevel();
Logger wrapped = wrapped();
if (wrapped.isLoggable(systemLevel)) {
final String sClass = sourceClass == null ? "" : sourceClass;
final String sMethod = sourceMethod == null ? "" : sourceMethod;
wrapped.log(systemLevel, () -> String.format("[%s %s] %s", sClass, sMethod, msgSupplier.get()), thrown);
}
}
} else {
platformProxy.logp(level, sourceClass, sourceMethod, thrown, msgSupplier);
}
}
use of java.lang.System.Logger.Level in project Bytecoder by mirkosertic.
the class AbstractLoggerWrapper method logrb.
@Override
public void logrb(PlatformLogger.Level level, String sourceClass, String sourceMethod, ResourceBundle bundle, String msg, Object... params) {
final PlatformLogger.Bridge platformProxy = platformProxy();
if (platformProxy == null) {
// best effort
if (bundle != null || sourceClass == null && sourceMethod == null) {
wrapped().log(level.systemLevel(), bundle, msg, params);
} else {
Level systemLevel = level.systemLevel();
Logger wrapped = wrapped();
if (wrapped.isLoggable(systemLevel)) {
sourceClass = sourceClass == null ? "" : sourceClass;
sourceMethod = sourceMethod == null ? "" : sourceMethod;
msg = msg == null ? "" : msg;
wrapped.log(systemLevel, bundle, String.format("[%s %s] %s", sourceClass, sourceMethod, msg), params);
}
}
} else {
platformProxy.logrb(level, sourceClass, sourceMethod, bundle, msg, params);
}
}
use of java.lang.System.Logger.Level in project Bytecoder by mirkosertic.
the class AbstractLoggerWrapper method logp.
@Override
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg) {
final PlatformLogger.Bridge platformProxy = platformProxy();
if (platformProxy == null) {
if (sourceClass == null && sourceMethod == null) {
// best effort
wrapped().log(level.systemLevel(), msg);
} else {
Level systemLevel = level.systemLevel();
Logger wrapped = wrapped();
if (wrapped.isLoggable(systemLevel)) {
sourceClass = sourceClass == null ? "" : sourceClass;
sourceMethod = sourceMethod == null ? "" : sourceMethod;
msg = msg == null ? "" : msg;
wrapped.log(systemLevel, String.format("[%s %s] %s", sourceClass, sourceMethod, msg));
}
}
} else {
platformProxy.logp(level, sourceClass, sourceMethod, msg);
}
}
use of java.lang.System.Logger.Level in project Bytecoder by mirkosertic.
the class AbstractLoggerWrapper method logp.
@Override
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, Supplier<String> msgSupplier) {
final PlatformLogger.Bridge platformProxy = platformProxy();
if (platformProxy == null) {
// best effort
if (sourceClass == null && sourceMethod == null) {
wrapped().log(level.systemLevel(), msgSupplier);
} else {
Level systemLevel = level.systemLevel();
Logger wrapped = wrapped();
if (wrapped.isLoggable(systemLevel)) {
final String sClass = sourceClass == null ? "" : sourceClass;
final String sMethod = sourceMethod == null ? "" : sourceMethod;
wrapped.log(systemLevel, () -> String.format("[%s %s] %s", sClass, sMethod, msgSupplier.get()));
}
}
} else {
platformProxy.logp(level, sourceClass, sourceMethod, msgSupplier);
}
}
use of java.lang.System.Logger.Level in project Bytecoder by mirkosertic.
the class AbstractLoggerWrapper method logp.
@Override
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg, Throwable thrown) {
final PlatformLogger.Bridge platformProxy = platformProxy();
if (platformProxy == null) {
// best effort
if (sourceClass == null && sourceMethod == null) {
wrapped().log(level.systemLevel(), msg, thrown);
} else {
Level systemLevel = level.systemLevel();
Logger wrapped = wrapped();
if (wrapped.isLoggable(systemLevel)) {
sourceClass = sourceClass == null ? "" : sourceClass;
sourceMethod = sourceMethod == null ? "" : sourceMethod;
msg = msg == null ? "" : msg;
wrapped.log(systemLevel, String.format("[%s %s] %s", sourceClass, sourceMethod, msg), thrown);
}
}
} else {
platformProxy.logp(level, sourceClass, sourceMethod, msg, thrown);
}
}
Aggregations