Package io.deephaven.logging
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.
-
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 interfacecom.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
-