public final class EmptyLoggingContext extends LoggingContext
See class documentation in LoggingContext for important implementation restrictions.
| Modifier and Type | Method and Description |
|---|---|
static LoggingContext |
getInstance() |
com.google.common.flogger.backend.Tags |
getTags()
Returns a set of tags to be added to a log statement.
|
boolean |
shouldForceLogging(java.lang.String loggerName,
java.util.logging.Level level,
boolean isEnabled)
Returns whether the given logger should have logging forced at the specified level.
|
java.lang.String |
toString() |
public static LoggingContext getInstance()
public boolean shouldForceLogging(java.lang.String loggerName,
java.util.logging.Level level,
boolean isEnabled)
LoggingContextA default implementation of this method should simply return false.
loggerName can be used to look up specific configuration, such as log level, for
the logger, to decide if a log statement should be forced. This information might vary
depending on the context in which this call is made, so the result should not be cached.
isEnabledByLevel indicates that the log statement is enabled according to its log
level, but a true value does not necessarily indicate that logging will occur, due to
rate limiting or other conditional logging mechanisms. To bypass conditional logging and
ensure that an enabled log statement will be emitted, this method should return true
if isEnabledByLevel was true.
WARNING: This method MUST complete quickly and without allocating any memory. It is invoked for every log statement regardless of logging configuration, so any implementation must go to every possible length to be efficient.
shouldForceLogging in class LoggingContextloggerName - the fully qualified logger name (e.g. "com.example.SomeClass")level - the level of the log statement being invokedisEnabled - whether the logger is enabled at the given levelpublic com.google.common.flogger.backend.Tags getTags()
LoggingContextA default implementation of this method should simply return Tags.empty().
getTags in class LoggingContextpublic java.lang.String toString()
toString in class java.lang.Object