- All Known Subinterfaces:
IStringLogEntryProcessor
- All Known Implementing Classes:
AStringLogEntryProcessor
,LoggerPanel
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents an object that processes a log entry. This could include any
of a number of processes, including but not limited to printing, GUI display,
storage, transmission, etc.
- Author:
- swong
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Process the given log entrystatic ILogEntryProcessor
Instantiate a log entry processor that prints to the console using the ILogEntryFormatter.DEFAULT formatter.static ILogEntryProcessor
MakeDefault(ILogEntryFormatter leFormatter)
Instantiate a log entry processor that prints to the console using the given log entry formatter.static ILogEntryProcessor
Wrap(BiConsumer<LogLevel,String> logConsumer, boolean appendLocation)
Convenience factory to wrap a Consumer<LogEntry, String> in an ILogEntryProcessor so that it can be used in an ILogger.
-
Method Details
-
accept
Process the given log entry- Parameters:
logEntry
- The log entry to process
-
MakeDefault
Instantiate a log entry processor that prints to the console using the ILogEntryFormatter.DEFAULT formatter. Convenience method that simply delegates to Make(ILogEntryFormatter.DEFAULT).- Returns:
- A new ILogEntryProcessor instance
-
MakeDefault
Instantiate a log entry processor that prints to the console using the given log entry formatter. LogLevel.ERROR entries are printed to stderr while others are printed to stdout.- Parameters:
leFormatter
- The ILogEntryFormatter to use- Returns:
- A new ILogEntryProcessor instance
-
Wrap
Convenience factory to wrap a Consumer<LogEntry, String> in an ILogEntryProcessor so that it can be used in an ILogger. Note that if the Consumer is delegating to a logger, that logger will NOT display the code location of the Consumer call, rather it will display the code location of the logger's log() call. The appendLocation parameter enables the location of ILogEntryProcessor's ILogEntry parameter to be appended to the log message so that it will appear in Consumer's resultant output.- Parameters:
logConsumer
- The Consumer to wrapappendLocation
- If true, "[@ code_location]" will be appended to the message.- Returns:
- An ILogEntryProcessor instance
-