- All Known Implementing Classes:
Logger
public interface ILogger
Represents a logger object that is the head node of a chain of logger objects.
- Author:
- swong
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
addLogProcessor(ILogEntryProcessor logProcFn)
Add the given log entry processor to the set of processors being used.Appends the chain represented by the given logger into this logger chain.boolean
TYPICAL DEVELOPER CODE NEVER CALLS THIS METHOD! Searches the this logger chain to find any occurrence of the given ILogger.void
TYPICAL DEVELOPER CODE NEVER CALLS THIS METHOD! Log the given log entry using a completed ILogEntry object where the code location is being explicitly specified.void
Log the given log entry where the code location is being automatically calculate.Remove the given logger from anywhere in the logger chain that begins with this logger.boolean
removeLogProcessor(ILogEntryProcessor logProcFn)
Remove the given log entry processor from the set of processors being used.void
setLogLevel(LogLevel logLevel)
Sets the minimum log level to be displayed.void
setLogProcessor(ILogEntryProcessor logProcFn)
Set the log entry processor being used.
-
Field Details
-
NULL
Null logger instance that is a no-op or return false except for its append() method which returns the given ILogger object.
-
-
Method Details
-
log
Log the given log entry where the code location is being automatically calculate.- Parameters:
level
- The log level of the entrymsg
- The message of the entry
-
log
TYPICAL DEVELOPER CODE NEVER CALLS THIS METHOD! Log the given log entry using a completed ILogEntry object where the code location is being explicitly specified. This method is used by ILoggers during a chained log.- Parameters:
logEntry
- The log entry to process
-
setLogLevel
Sets the minimum log level to be displayed.- Parameters:
logLevel
- The minimum log level to be displayed.
-
setLogProcessor
Set the log entry processor being used. This processor will replace ALL processors currently in use.- Parameters:
logProcFn
- The new log processor function.
-
addLogProcessor
Add the given log entry processor to the set of processors being used. Duplicate processors will not be added and will return a False value.- Parameters:
logProcFn
- The new log processor function to add.- Returns:
- true if the processor was successfully added, false if the processor was already in the current set of processors or could not be added.
-
removeLogProcessor
Remove the given log entry processor from the set of processors being used. The last processor cannot be removed (returns false).- Parameters:
logProcFn
- The new log processor function to remove.- Returns:
- true if the processor was found and removed, false otherwise.
-
append
Appends the chain represented by the given logger into this logger chain.- Parameters:
logger
- The logger and the rest of its chain to append to the end of this logger's chain.- Returns:
- The logger at the head of the new chain. A non-empty chain returns itself while an empty chain returns the given logger.
- Throws:
IllegalStateException
- if a circular chain would be created.
-
remove
Remove the given logger from anywhere in the logger chain that begins with this logger.- Parameters:
logger
- The logger to remove from the chain.- Returns:
- Returns the head of the new logger chain, typically this ILogger unless this logger is the one being removed, when ILogger.NULL is returned.
-
find
TYPICAL DEVELOPER CODE NEVER CALLS THIS METHOD! Searches the this logger chain to find any occurrence of the given ILogger. This method is used between ILoggers to check for potential loops in chains.- Parameters:
logger
- The logger chain to search for- Returns:
- true if found, false otherwise
-