Class LoggerOutputStream

java.lang.Object
java.io.OutputStream
org.omegazero.common.logging.LoggerOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class LoggerOutputStream extends OutputStream
An OutputStream for writing to a Logger instance at a given LogLevel.
Since:
2.1
  • Constructor Details

    • LoggerOutputStream

      public LoggerOutputStream(Logger loggerInstance, LogLevel outputLevel)
      Creates a LoggerOutputStream with the given Logger instance and output LogLevel.
      Parameters:
      loggerInstance - The Logger instance
      outputLevel - The LogLevel to output log messages with
      Since:
      2.10
  • Method Details

    • writeOut

      public void writeOut()
      Writes the data stored in the internal buffer as a log message to the Logger and with the LogLevel given in the constructor.
    • write

      public void write(int b) throws IOException
      Specified by:
      write in class OutputStream
      Throws:
      IOException
    • flush

      public void flush()
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream