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

    Constructors
    Constructor
    Description
    Constructs a new IsolatedConsoleWriter with default properties.
    Constructs a new IsolatedConsoleWriter with custom properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes both the standard output and error streams.
    void
    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

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IsolatedConsoleWriter

      public IsolatedConsoleWriter()
      Constructs a new IsolatedConsoleWriter with default properties.
    • IsolatedConsoleWriter

      public IsolatedConsoleWriter(Map<String,String> properties)
      Constructs a new IsolatedConsoleWriter with custom properties.
      Parameters:
      properties - The properties map for custom configuration.
  • Method Details

    • getRequiredLogEntryValues

      public Collection<org.tinylog.core.LogEntryValue> getRequiredLogEntryValues()
      Returns the collection of log entry values required by this writer.
      Specified by:
      getRequiredLogEntryValues in interface org.tinylog.writers.Writer
      Overrides:
      getRequiredLogEntryValues in class org.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.