Class TempLogInterceptor

java.lang.Object
io.deephaven.logging.TempLogInterceptor
All Implemented Interfaces:
com.fishlib.io.log.LogSink.Interceptor<com.fishlib.io.log.LogEntry>

public class TempLogInterceptor extends Object implements com.fishlib.io.log.LogSink.Interceptor<com.fishlib.io.log.LogEntry>
Queue log messages for a brief time while creating the initial logger. This captures noise that would go to STDOUT and holds it until there's a better destination for it.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Empty the queue without logging.
    void
    element(com.fishlib.io.log.LogEntry e, com.fishlib.base.log.LogOutput logOutput)
     
    void
    flush(com.fishlib.io.logger.Logger maybeLog)
    Empty the queue to maybeLog, or to STDOUT if not given.
    static com.fishlib.io.logger.Logger
    quietLogCreator(Supplier<com.fishlib.io.logger.Logger> logProducer)
    Intercept any log messages produced while creating a logger, then dump those messages to the created logger.

    Methods inherited from class java.lang.Object

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

    • TempLogInterceptor

      public TempLogInterceptor()
  • Method Details

    • quietLogCreator

      @Nullable public static com.fishlib.io.logger.Logger quietLogCreator(@NotNull Supplier<com.fishlib.io.logger.Logger> logProducer)
      Intercept any log messages produced while creating a logger, then dump those messages to the created logger. This is required to redirect logging messages produced during initialization away from stdout.
      Parameters:
      logProducer - code to produce a logger
      Returns:
      the logger created by the supplier
    • element

      public void element(com.fishlib.io.log.LogEntry e, com.fishlib.base.log.LogOutput logOutput) throws IOException
      Specified by:
      element in interface com.fishlib.io.log.LogSink.Interceptor<com.fishlib.io.log.LogEntry>
      Throws:
      IOException
    • flush

      public void flush(@Nullable com.fishlib.io.logger.Logger maybeLog)
      Empty the queue to maybeLog, or to STDOUT if not given. This is reentrant and deactivates the interceptor.
      Parameters:
      maybeLog - optional sink for log messages
    • clear

      public void clear()
      Empty the queue without logging. This is reentrant and deactivates the interceptor.