LOGGER - The logger implementation from which this context is produced.API - The logging api supported by this context.@CheckReturnValue public abstract class GoogleLogContext<LOGGER extends com.google.common.flogger.AbstractLogger<API>,API extends GoogleLoggingApi<API>> extends com.google.common.flogger.LogContext<LOGGER,API> implements GoogleLoggingApi<API>
com.google.common.flogger.LogContext.KeyGoogleLoggingApi.NoOp<API extends GoogleLoggingApi<API>>| Modifier | Constructor and Description |
|---|---|
protected |
GoogleLogContext(java.util.logging.Level level,
boolean isForced)
Creates a logging context for the GoogleLoggerApi.
|
| Modifier and Type | Method and Description |
|---|---|
protected com.google.common.flogger.parser.MessageParser |
getMessageParser() |
<T> API |
with(com.google.common.flogger.MetadataKey<T> key,
T value)
Associates a metadata key constant with a runtime value for this log statement in a structured
way that is accessible to logger backends.
|
addMetadata, api, atMostEvery, every, getArguments, getLevel, getLiteralArgument, getLogger, getLoggerName, getLogSite, getMetadata, getTemplateContext, getTimestampMicros, getTimestampNanos, isEnabled, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, logVarargs, noOp, postProcess, removeMetadata, wasForced, withCause, withInjectedLogSite, withInjectedLogSite, withStackTraceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitatMostEvery, every, isEnabled, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, log, logVarargs, withCause, withInjectedLogSite, withInjectedLogSite, withStackTraceprotected GoogleLogContext(java.util.logging.Level level,
boolean isForced)
level - the log level of this log statement.isForced - whether the log statement should be forced.protected final com.google.common.flogger.parser.MessageParser getMessageParser()
getMessageParser in class com.google.common.flogger.LogContext<LOGGER extends com.google.common.flogger.AbstractLogger<API>,API extends GoogleLoggingApi<API>>public final <T> API with(com.google.common.flogger.MetadataKey<T> key, @Nullable T value)
GoogleLoggingApiThis method is not a replacement for general parameter passing in the LoggingApi.log() method
and should be reserved for keys/values with specific semantics. Examples include:
Metadata keys can support repeated values (see MetadataKey.canRepeat()), and if a
repeatable key is used multiple times in the same log statement, the effect is to collect all
the given values in order. If a non-repeatable key is passed multiple times, only the last
value is retained (though callers should not rely on this behavior and should simply avoid
repeating non-repeatable keys).
If value is null, this method is a no-op. This is useful for specifying
conditional values (e.g. via logger.atInfo().with(MY_KEY, getValueOrNull()).log(...)).
with in interface GoogleLoggingApi<API extends GoogleLoggingApi<API>>key - the metadata key (expected to be a static constant)value - a value to be associated with the key in this log statement. Null values are
allowed, but the effect is always a no-opMetadataKey