Package nxt.util
Class Logger
- java.lang.Object
-
- nxt.util.Logger
-
public final class Logger extends java.lang.Object
Handle logging for the Nxt node server
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Logger.Event
Log event typesstatic class
Logger.Level
Log levels
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
addExceptionListener(Listener<java.lang.Throwable> listener, Logger.Event eventType)
Add an exception listenerstatic boolean
addMessageListener(Listener<java.lang.String> listener, Logger.Event eventType)
Add a message listenerstatic void
init()
Logger initializationstatic boolean
isDebugEnabled()
static boolean
isErrorEnabled()
static boolean
isInfoEnabled()
static boolean
isWarningEnabled()
static void
logDebugMessage(java.lang.String message)
Log a debug messagestatic void
logDebugMessage(java.lang.String format, java.lang.Object... args)
Log a debug messagestatic void
logDebugMessage(java.lang.String message, java.lang.Throwable exc)
Log a debug exceptionstatic void
logErrorMessage(java.lang.String message)
Log an ERROR messagestatic void
logErrorMessage(java.lang.String format, java.lang.Object... args)
Log an ERROR messagestatic void
logErrorMessage(java.lang.String message, java.lang.Throwable exc)
Log an ERROR exceptionstatic void
logInfoMessage(java.lang.String message)
Log an INFO messagestatic void
logInfoMessage(java.lang.String format, java.lang.Object... args)
Log an INFO messagestatic void
logInfoMessage(java.lang.String message, java.lang.Throwable exc)
Log an INFO exceptionstatic void
logMessage(java.lang.String message)
Log a message (map to INFO)static void
logMessage(java.lang.String message, java.lang.Exception exc)
Log an exception (map to ERROR)static void
logShutdownMessage(java.lang.String message)
static void
logShutdownMessage(java.lang.String message, java.lang.Exception e)
static void
logWarningMessage(java.lang.String message)
Log a WARNING messagestatic void
logWarningMessage(java.lang.String format, java.lang.Object... args)
static void
logWarningMessage(java.lang.String message, java.lang.Throwable exc)
Log a WARNING exceptionstatic boolean
removeExceptionListener(Listener<java.lang.Throwable> listener, Logger.Event eventType)
Remove an exception listenerstatic boolean
removeMessageListener(Listener<java.lang.String> listener, Logger.Event eventType)
Remove a message listenerstatic void
setLevel(Logger.Level level)
Set the log levelstatic void
shutdown()
Logger shutdown
-
-
-
Method Detail
-
init
public static void init()
Logger initialization
-
shutdown
public static void shutdown()
Logger shutdown
-
setLevel
public static void setLevel(Logger.Level level)
Set the log level- Parameters:
level
- Desired log level
-
addMessageListener
public static boolean addMessageListener(Listener<java.lang.String> listener, Logger.Event eventType)
Add a message listener- Parameters:
listener
- ListenereventType
- Notification event type- Returns:
- TRUE if listener added
-
addExceptionListener
public static boolean addExceptionListener(Listener<java.lang.Throwable> listener, Logger.Event eventType)
Add an exception listener- Parameters:
listener
- ListenereventType
- Notification event type- Returns:
- TRUE if listener added
-
removeMessageListener
public static boolean removeMessageListener(Listener<java.lang.String> listener, Logger.Event eventType)
Remove a message listener- Parameters:
listener
- ListenereventType
- Notification event type- Returns:
- TRUE if listener removed
-
removeExceptionListener
public static boolean removeExceptionListener(Listener<java.lang.Throwable> listener, Logger.Event eventType)
Remove an exception listener- Parameters:
listener
- ListenereventType
- Notification event type- Returns:
- TRUE if listener removed
-
logMessage
public static void logMessage(java.lang.String message)
Log a message (map to INFO)- Parameters:
message
- Message
-
logMessage
public static void logMessage(java.lang.String message, java.lang.Exception exc)
Log an exception (map to ERROR)- Parameters:
message
- Messageexc
- Exception
-
logShutdownMessage
public static void logShutdownMessage(java.lang.String message)
-
logShutdownMessage
public static void logShutdownMessage(java.lang.String message, java.lang.Exception e)
-
isErrorEnabled
public static boolean isErrorEnabled()
-
logErrorMessage
public static void logErrorMessage(java.lang.String message)
Log an ERROR message- Parameters:
message
- Message
-
logErrorMessage
public static void logErrorMessage(java.lang.String format, java.lang.Object... args)
Log an ERROR message- Parameters:
format
- Message formatargs
- Message args
-
logErrorMessage
public static void logErrorMessage(java.lang.String message, java.lang.Throwable exc)
Log an ERROR exception- Parameters:
message
- Messageexc
- Exception
-
isWarningEnabled
public static boolean isWarningEnabled()
-
logWarningMessage
public static void logWarningMessage(java.lang.String message)
Log a WARNING message- Parameters:
message
- Message
-
logWarningMessage
public static void logWarningMessage(java.lang.String format, java.lang.Object... args)
-
logWarningMessage
public static void logWarningMessage(java.lang.String message, java.lang.Throwable exc)
Log a WARNING exception- Parameters:
message
- Messageexc
- Exception
-
isInfoEnabled
public static boolean isInfoEnabled()
-
logInfoMessage
public static void logInfoMessage(java.lang.String message)
Log an INFO message- Parameters:
message
- Message
-
logInfoMessage
public static void logInfoMessage(java.lang.String format, java.lang.Object... args)
Log an INFO message- Parameters:
format
- Message formatargs
- Message args
-
logInfoMessage
public static void logInfoMessage(java.lang.String message, java.lang.Throwable exc)
Log an INFO exception- Parameters:
message
- Messageexc
- Exception
-
isDebugEnabled
public static boolean isDebugEnabled()
-
logDebugMessage
public static void logDebugMessage(java.lang.String message)
Log a debug message- Parameters:
message
- Message
-
logDebugMessage
public static void logDebugMessage(java.lang.String format, java.lang.Object... args)
Log a debug message- Parameters:
format
- Message formatargs
- Message args
-
logDebugMessage
public static void logDebugMessage(java.lang.String message, java.lang.Throwable exc)
Log a debug exception- Parameters:
message
- Messageexc
- Exception
-
-