Package org.sosy_lab.common.log
Class LogManagerWithoutDuplicates
- java.lang.Object
-
- org.sosy_lab.common.log.ForwardingLogManager
-
- org.sosy_lab.common.log.LogManagerWithoutDuplicates
-
- All Implemented Interfaces:
LogManager
public class LogManagerWithoutDuplicates extends ForwardingLogManager implements LogManager
LogManager implementation which helps to get log messages printed only once, and avoid duplicate messages.
-
-
Constructor Summary
Constructors Constructor Description LogManagerWithoutDuplicates(LogManager pDelegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LogManager
delegate()
void
logfOnce(Level pPriority, String pFormat, Object... pArgs)
Logging method similar toForwardingLogManager.logf(Level, String, Object...)
, however, subsequent calls to this method with the same arguments will be silently ignored.void
logOnce(Level pPriority, Object... pArgs)
Logging method similar toForwardingLogManager.log(Level, Object...)
, however, subsequent calls to this method with the same arguments will be silently ignored.void
logOnce(Level pPriority, Supplier<String> pMsgSupplier)
Logging method similar toForwardingLogManager.log(Level, Supplier)
, however, subsequent calls to this method with the same arguments will be silently ignored.void
resetSeenMessages()
Reset all seen log messages, such thatlogfOnce(Level, String, Object...)
andlogfOnce(Level, String, Object...)
will be guaranteed to behave exactly like in a fresh instance of this class.LogManagerWithoutDuplicates
withComponentName(String pName)
This method returns a new LogManagerWithoutDuplicates, which does not share state with the current instance (i.e., it is possible to log the same message both through the old and the new instance once).-
Methods inherited from class org.sosy_lab.common.log.ForwardingLogManager
flush, log, log, logDebugException, logDebugException, logException, logf, logfDebugException, logfException, logfUserException, logUserException, wouldBeLogged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sosy_lab.common.log.LogManager
flush, log, log, logDebugException, logDebugException, logException, logf, logfDebugException, logfException, logfUserException, logUserException, wouldBeLogged
-
-
-
-
Constructor Detail
-
LogManagerWithoutDuplicates
public LogManagerWithoutDuplicates(LogManager pDelegate)
-
-
Method Detail
-
delegate
protected LogManager delegate()
- Specified by:
delegate
in classForwardingLogManager
-
withComponentName
public LogManagerWithoutDuplicates withComponentName(String pName)
This method returns a new LogManagerWithoutDuplicates, which does not share state with the current instance (i.e., it is possible to log the same message both through the old and the new instance once).- Specified by:
withComponentName
in interfaceLogManager
- Parameters:
pName
- A non-empty string.- Returns:
- A LogManager instance.
- See Also:
LogManager.withComponentName(String)
-
logOnce
public void logOnce(Level pPriority, Object... pArgs)
Logging method similar toForwardingLogManager.log(Level, Object...)
, however, subsequent calls to this method with the same arguments will be silently ignored. Direct calls toForwardingLogManager.log(Level, Object...)
are not affected.Make sure to call this method only with immutable parameters, such as Strings! If objects are changed after being passed to this method, detecting duplicate log messages may not work, or too many log messages may be ignored.
-
logOnce
public void logOnce(Level pPriority, Supplier<String> pMsgSupplier)
Logging method similar toForwardingLogManager.log(Level, Supplier)
, however, subsequent calls to this method with the same arguments will be silently ignored. Direct calls toForwardingLogManager.log(Level, Supplier)
are not affected.Make sure to call this method only with immutable parameters, such as Strings! If objects are changed after being passed to this method, detecting duplicate log messages may not work, or too many log messages may be ignored.
-
logfOnce
@FormatMethod public void logfOnce(Level pPriority, String pFormat, Object... pArgs)
Logging method similar toForwardingLogManager.logf(Level, String, Object...)
, however, subsequent calls to this method with the same arguments will be silently ignored. Direct calls toForwardingLogManager.logf(Level, String, Object...)
are not affected.Make sure to call this method only with immutable parameters, such as Strings! If objects are changed after being passed to this method, detecting duplicate log messages may not work, or too many log messages may be ignored.
-
resetSeenMessages
public void resetSeenMessages()
Reset all seen log messages, such thatlogfOnce(Level, String, Object...)
andlogfOnce(Level, String, Object...)
will be guaranteed to behave exactly like in a fresh instance of this class.
-
-