Package htsjdk.samtools.util
Class Log
java.lang.Object
htsjdk.samtools.util.Log
A wafer thin wrapper around System.err that uses var-args to make it much more efficient to call the logging methods in without having to surround every call site with calls to Log.isXXXEnabled(). All the methods on this class take a variable length list of arguments and, only if logging is enabled for the level and channel being logged to, will those arguments be toString()'d and appended together.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionfinal voidLogs one or more message parts at level debug.final voidLogs a Throwable and optional message parts at level debug.final voidLogs a message at level debug.final voidLogs one or more message parts at level error.final voidLogs a Throwable and optional message parts at level error.final voidLogs a message part at level error.static Log.LogLevelGet the log level.static PrintStreamGet thePrintStreamfor writing.static LoggetInstance(Class<?> clazz) Get a Log instance to perform logging within the Class specified.protected StringCreates a date string for insertion into the log.final voidLogs one or more message parts at level info.final voidLogs a Throwable and optional message parts at level info.final voidLogs a message part at level info.static final booleanisEnabled(Log.LogLevel level) Returns true if the specified log level is enabled otherwise false.static voidsetGlobalLogLevel(Log.LogLevel logLevel) Set the log level.static voidsetGlobalPrintStream(PrintStream stream) Set thePrintStreamfor writing.final voidLogs one or more message parts at level warn.final voidLogs a Throwable and optional message parts at level warn.final voidLogs a message part at level warn.
-
Method Details
-
getInstance
Get a Log instance to perform logging within the Class specified. Returns an instance of this class which wraps an instance of the commons logging Log class.- Parameters:
clazz- the Class which is going to be doing the logging- Returns:
- a Log instance with which to log
-
setGlobalLogLevel
Set the log level.- Parameters:
logLevel- The log level enumeration
-
getGlobalLogLevel
Get the log level.- Returns:
- The enumeration for setting log levels.
-
setGlobalPrintStream
Set thePrintStreamfor writing.- Parameters:
stream-PrintStreamto write to.
-
getGlobalPrintStream
Get thePrintStreamfor writing.- Returns:
PrintStreamto write to.
-
isEnabled
Returns true if the specified log level is enabled otherwise false. -
getTimestamp
Creates a date string for insertion into the log. Given that logs are sometimes held statically and SimpleDateFormat is not thread safe, currently creates an instance each time :/ -
error
Logs a Throwable and optional message parts at level error.- Parameters:
throwable- an instance of Throwable that should be logged with stack tracemessageParts- zero or more objects which should be combined, by calling toString() to form the log message.
-
warn
Logs a Throwable and optional message parts at level warn.- Parameters:
throwable- an instance of Throwable that should be logged with stack tracemessageParts- zero or more objects which should be combined, by calling toString() to form the log message.
-
info
Logs a Throwable and optional message parts at level info.- Parameters:
throwable- an instance of Throwable that should be logged with stack tracemessageParts- zero or more objects which should be combined, by calling toString() to form the log message.
-
debug
Logs a Throwable and optional message parts at level debug.- Parameters:
throwable- an instance of Throwable that should be logged with stack tracemessageParts- zero or more objects which should be combined, by calling toString() to form the log message.
-
error
Logs one or more message parts at level error.- Parameters:
messageParts- one or more objects which should be combined, by calling toString() to form the log message.
-
warn
Logs one or more message parts at level warn.- Parameters:
messageParts- one or more objects which should be combined, by calling toString() to form the log message.
-
info
Logs one or more message parts at level info.- Parameters:
messageParts- one or more objects which should be combined, by calling toString() to form the log message.
-
debug
Logs one or more message parts at level debug.- Parameters:
messageParts- one or more objects which should be combined, by calling toString() to form the log message.
-
error
Logs a message part at level error.- Parameters:
messageParts- a supplier of the object that will be obtained and then toString'ed to form the log message.
-
warn
Logs a message part at level warn.- Parameters:
messageParts- a supplier of the object that will be obtained and then toString'ed to form the log message.
-
info
Logs a message part at level info.- Parameters:
messageParts- a supplier of the object that will be obtained and then toString'ed to form the log message.
-
debug
Logs a message at level debug.- Parameters:
messageParts- a supplier of the object that will be obtained and then toString'ed to form the log message.
-