com.tenduke.diagnostics
Class ConsoleLogWriter
java.lang.Object
com.tenduke.diagnostics.AbstractLogWriter
com.tenduke.diagnostics.ConsoleLogWriter
- All Implemented Interfaces:
- LogEntrySubscriber
public class ConsoleLogWriter
- extends AbstractLogWriter
Log writer that listens to log entries published by a Logger and writes error messages to console (stderr).
ConsoleLogWriter is derived from AbstractLogWriter, see AbstractLogWriter documentation for ConsoleLogWriter configurations.
|
Constructor Summary |
ConsoleLogWriter()
Initializes new instance of the ConsoleLogWriter class. |
|
Method Summary |
protected void |
printError(LogEntry entry,
java.lang.Throwable throwable)
Prints error in the case that printing log entry failed. |
protected void |
printLogEntry(LogEntry logEntry,
java.lang.String formatTemplate)
Prints log entry to log using the given format template. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConsoleLogWriter
public ConsoleLogWriter()
- Initializes new instance of the ConsoleLogWriter class.
printError
protected void printError(LogEntry entry,
java.lang.Throwable throwable)
- Prints error in the case that printing log entry failed.
- Specified by:
printError in class AbstractLogWriter
- Parameters:
entry - LogEntry for which writing failed.throwable - The error that occurred when attempting to write.
printLogEntry
protected void printLogEntry(LogEntry logEntry,
java.lang.String formatTemplate)
throws java.io.IOException
- Prints log entry to log using the given format template.
- Specified by:
printLogEntry in class AbstractLogWriter
- Parameters:
logEntry - LogEntry to write.formatTemplate - Format template to use.
- Throws:
java.io.IOException - Thrown if printing log entry fails.