mirror of
https://github.com/corda/corda.git
synced 2025-06-16 14:18:20 +00:00
add logp methods to Logger
This commit is contained in:
@ -67,15 +67,34 @@ public class Logger {
|
|||||||
log(level, Method.getCaller(), message, exception);
|
log(level, Method.getCaller(), message, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void logp(Level level, String sourceClass, String sourceMethod, String msg) {
|
||||||
|
if (!isLoggable(level)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
publish(new LogRecord(name, sourceMethod, level, msg, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void logp(Level level, String sourceClass, String sourceMethod,
|
||||||
|
String msg, Throwable thrown) {
|
||||||
|
if (!isLoggable(level)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
publish(new LogRecord(name, sourceMethod, level, msg, thrown));
|
||||||
|
}
|
||||||
|
|
||||||
private void log(Level level, Method caller, String message,
|
private void log(Level level, Method caller, String message,
|
||||||
Throwable exception) {
|
Throwable exception) {
|
||||||
if (level.intValue()<levelValue) {
|
if (level.intValue()<levelValue) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LogRecord r = new LogRecord(name, caller.getName(), level, message,
|
LogRecord r = new LogRecord(name, caller.getName(), level, message,
|
||||||
exception);
|
exception);
|
||||||
|
publish(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void publish(LogRecord logRecord) {
|
||||||
for (Handler h : handlers) {
|
for (Handler h : handlers) {
|
||||||
h.publish(r);
|
h.publish(logRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user