- java.lang.Object
-
- io.netty5.util.internal.logging.AbstractInternalLogger
-
- All Implemented Interfaces:
InternalLogger
,Serializable
public abstract class AbstractInternalLogger extends Object implements InternalLogger, Serializable
A skeletal implementation ofInternalLogger
. This class implements all methods that have aInternalLogLevel
parameter by default to call specific logger methods such asInternalLogger.info(String)
orInternalLogger.isInfoEnabled()
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractInternalLogger(String name)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
debug(Throwable t)
Log an exception (throwable) at the DEBUG level.void
error(Throwable t)
Log an exception (throwable) at the ERROR level.void
info(Throwable t)
Log an exception (throwable) at the INFO level.boolean
isEnabled(InternalLogLevel level)
Is the logger instance enabled for the specifiedlevel
?void
log(InternalLogLevel level, String msg)
Log a message at the specifiedlevel
.void
log(InternalLogLevel level, String format, Object arg)
Log a message at the specifiedlevel
according to the specified format and argument.void
log(InternalLogLevel level, String format, Object... arguments)
Log a message at the specifiedlevel
according to the specified format and arguments.void
log(InternalLogLevel level, String format, Object argA, Object argB)
Log a message at the specifiedlevel
according to the specified format and arguments.void
log(InternalLogLevel level, String msg, Throwable cause)
Log an exception (throwable) at the specifiedlevel
with an accompanying message.void
log(InternalLogLevel level, Throwable cause)
Log an exception (throwable) at the specifiedlevel
.String
name()
Return the name of thisInternalLogger
instance.protected Object
readResolve()
String
toString()
void
trace(Throwable t)
Log an exception (throwable) at the TRACE level.void
warn(Throwable t)
Log an exception (throwable) at the WARN level.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty5.util.internal.logging.InternalLogger
debug, debug, debug, debug, debug, error, error, error, error, error, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn
-
-
-
-
Constructor Detail
-
AbstractInternalLogger
protected AbstractInternalLogger(String name)
Creates a new instance.
-
-
Method Detail
-
name
public String name()
Description copied from interface:InternalLogger
Return the name of thisInternalLogger
instance.- Specified by:
name
in interfaceInternalLogger
- Returns:
- name of this logger instance
-
isEnabled
public boolean isEnabled(InternalLogLevel level)
Description copied from interface:InternalLogger
Is the logger instance enabled for the specifiedlevel
?- Specified by:
isEnabled
in interfaceInternalLogger
- Returns:
- True if this Logger is enabled for the specified
level
, false otherwise.
-
trace
public void trace(Throwable t)
Description copied from interface:InternalLogger
Log an exception (throwable) at the TRACE level.- Specified by:
trace
in interfaceInternalLogger
- Parameters:
t
- the exception (throwable) to log
-
debug
public void debug(Throwable t)
Description copied from interface:InternalLogger
Log an exception (throwable) at the DEBUG level.- Specified by:
debug
in interfaceInternalLogger
- Parameters:
t
- the exception (throwable) to log
-
info
public void info(Throwable t)
Description copied from interface:InternalLogger
Log an exception (throwable) at the INFO level.- Specified by:
info
in interfaceInternalLogger
- Parameters:
t
- the exception (throwable) to log
-
warn
public void warn(Throwable t)
Description copied from interface:InternalLogger
Log an exception (throwable) at the WARN level.- Specified by:
warn
in interfaceInternalLogger
- Parameters:
t
- the exception (throwable) to log
-
error
public void error(Throwable t)
Description copied from interface:InternalLogger
Log an exception (throwable) at the ERROR level.- Specified by:
error
in interfaceInternalLogger
- Parameters:
t
- the exception (throwable) to log
-
log
public void log(InternalLogLevel level, String msg, Throwable cause)
Description copied from interface:InternalLogger
Log an exception (throwable) at the specifiedlevel
with an accompanying message.- Specified by:
log
in interfaceInternalLogger
msg
- the message accompanying the exceptioncause
- the exception (throwable) to log
-
log
public void log(InternalLogLevel level, Throwable cause)
Description copied from interface:InternalLogger
Log an exception (throwable) at the specifiedlevel
.- Specified by:
log
in interfaceInternalLogger
cause
- the exception (throwable) to log
-
log
public void log(InternalLogLevel level, String msg)
Description copied from interface:InternalLogger
Log a message at the specifiedlevel
.- Specified by:
log
in interfaceInternalLogger
msg
- the message string to be logged
-
log
public void log(InternalLogLevel level, String format, Object arg)
Description copied from interface:InternalLogger
Log a message at the specifiedlevel
according to the specified format and argument.This form avoids superfluous object creation when the logger is disabled for the specified
level
.- Specified by:
log
in interfaceInternalLogger
format
- the format stringarg
- the argument
-
log
public void log(InternalLogLevel level, String format, Object argA, Object argB)
Description copied from interface:InternalLogger
Log a message at the specifiedlevel
according to the specified format and arguments.This form avoids superfluous object creation when the logger is disabled for the specified
level
.- Specified by:
log
in interfaceInternalLogger
format
- the format stringargA
- the first argumentargB
- the second argument
-
log
public void log(InternalLogLevel level, String format, Object... arguments)
Description copied from interface:InternalLogger
Log a message at the specifiedlevel
according to the specified format and arguments.This form avoids superfluous string concatenation when the logger is disabled for the specified
level
. However, this variant incurs the hidden (and relatively small) cost of creating anObject[]
before invoking the method, even if this logger is disabled for the specifiedlevel
. The variants takingone
andtwo
arguments exist solely in order to avoid this hidden cost.- Specified by:
log
in interfaceInternalLogger
format
- the format stringarguments
- a list of 3 or more arguments
-
readResolve
protected Object readResolve() throws ObjectStreamException
- Throws:
ObjectStreamException
-
-