Package com.avrix.logs
Class IsolatedConsoleWriter
java.lang.Object
org.tinylog.writers.AbstractWriter
org.tinylog.writers.AbstractFileBasedWriter
org.tinylog.writers.AbstractFormatPatternWriter
com.avrix.logs.IsolatedConsoleWriter
- All Implemented Interfaces:
org.tinylog.writers.Writer
public class IsolatedConsoleWriter
extends org.tinylog.writers.AbstractFormatPatternWriter
Console writer for Tinylog that redirects logging to isolated streams.
This writer is based on
ConsoleWriter
but redirects output
to custom streams, allowing isolation from System.out
and System.err
.
Logs of different levels are written to either the standard output stream or error stream
based on configured error levels.-
Constructor Summary
ConstructorDescriptionConstructs a new IsolatedConsoleWriter with default properties.IsolatedConsoleWriter
(Map<String, String> properties) Constructs a new IsolatedConsoleWriter with custom properties. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes both the standard output and error streams.void
flush()
Flushes both the standard output and error streams.Collection<org.tinylog.core.LogEntryValue>
Returns the collection of log entry values required by this writer.void
write
(org.tinylog.core.LogEntry logEntry) Writes the log entry to the appropriate output stream based on the log entry's level.Methods inherited from class org.tinylog.writers.AbstractWriter
getBooleanValue, getStringValue
-
Constructor Details
-
IsolatedConsoleWriter
public IsolatedConsoleWriter()Constructs a new IsolatedConsoleWriter with default properties. -
IsolatedConsoleWriter
Constructs a new IsolatedConsoleWriter with custom properties.- Parameters:
properties
- The properties map for custom configuration.
-
-
Method Details
-
getRequiredLogEntryValues
Returns the collection of log entry values required by this writer.- Specified by:
getRequiredLogEntryValues
in interfaceorg.tinylog.writers.Writer
- Overrides:
getRequiredLogEntryValues
in classorg.tinylog.writers.AbstractFormatPatternWriter
- Returns:
- A collection of log entry values including
LogEntryValue.LEVEL
.
-
write
public void write(org.tinylog.core.LogEntry logEntry) Writes the log entry to the appropriate output stream based on the log entry's level.- Parameters:
logEntry
- The log entry to be written.
-
flush
public void flush()Flushes both the standard output and error streams. -
close
public void close()Closes both the standard output and error streams.
-