Package io.pravega.common
Class LoggerHelpers
- java.lang.Object
-
- io.pravega.common.LoggerHelpers
-
public final class LoggerHelpers extends java.lang.ObjectExtension methods for Logger class.
-
-
Constructor Summary
Constructors Constructor Description LoggerHelpers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectexceptionSummary(org.slf4j.Logger log, java.lang.Throwable e)Returns either the givenThrowableor its message, depending on the current logging context.static longtraceEnter(org.slf4j.Logger log, java.lang.String method, java.lang.Object... args)Traces the fact that a method entry has occurred.static longtraceEnterWithContext(org.slf4j.Logger log, java.lang.String context, java.lang.String method, java.lang.Object... args)Traces the fact that a method entry has occurred.static voidtraceLeave(org.slf4j.Logger log, java.lang.String method, long traceEnterId, java.lang.Object... args)Traces the fact that a method has exited normally.static voidtraceLeave(org.slf4j.Logger log, java.lang.String context, java.lang.String method, long traceEnterId, java.lang.Object... args)Traces the fact that a method has exited normally.
-
-
-
Method Detail
-
traceEnter
public static long traceEnter(org.slf4j.Logger log, java.lang.String method, java.lang.Object... args)Traces the fact that a method entry has occurred.- Parameters:
log- The Logger to log to.method- The name of the method.args- The arguments to the method.- Returns:
- A generated identifier that can be used to correlate this traceEnter with its corresponding traceLeave. This is usually generated from the current System time, and when used with traceLeave it can be used to log elapsed call times.
-
traceEnterWithContext
public static long traceEnterWithContext(org.slf4j.Logger log, java.lang.String context, java.lang.String method, java.lang.Object... args)Traces the fact that a method entry has occurred.- Parameters:
log- The Logger to log to.context- Identifying context for the operation. For example, this can be used to differentiate between different instances of the same object.method- The name of the method.args- The arguments to the method.- Returns:
- A generated identifier that can be used to correlate this traceEnter with its corresponding traceLeave. This is usually generated from the current System time, and when used with traceLeave it can be used to log elapsed call times.
-
traceLeave
public static void traceLeave(org.slf4j.Logger log, java.lang.String method, long traceEnterId, java.lang.Object... args)Traces the fact that a method has exited normally.- Parameters:
log- The Logger to log to.method- The name of the method.traceEnterId- The correlation Id obtained from a traceEnter call.args- Additional arguments to log.
-
traceLeave
public static void traceLeave(org.slf4j.Logger log, java.lang.String context, java.lang.String method, long traceEnterId, java.lang.Object... args)Traces the fact that a method has exited normally.- Parameters:
log- The Logger to log to.context- Identifying context for the operation. For example, this can be used to differentiate between different instances of the same object.method- The name of the method.traceEnterId- The correlation Id obtained from a traceEnter call.args- Additional arguments to log.
-
exceptionSummary
public static java.lang.Object exceptionSummary(org.slf4j.Logger log, java.lang.Throwable e)Returns either the givenThrowableor its message, depending on the current logging context.- Parameters:
log- TheLoggerto query.e- TheThrowableto return or process.- Returns:
- The given
Throwable, ifLogger.isDebugEnabled()is true for log, orThrowable.toString()otherwise (which should output only the name of the exception).
-
-