API - The api returned during method chaining (possibly an extension of this interface).@CheckReturnValue
public interface GoogleLoggingApi<API extends GoogleLoggingApi<API>>
extends com.google.common.flogger.LoggingApi<API>
If a team wishes to implement its own logging extensions, it must extend this API (in the same
way that this API was extended from LoggingApi) and extend GoogleLogContext similarly.
This should all be tied together by implementing an alternate implementation of GoogleLogger.
However, if you wish to extend the default logging API, please contact flogger-dev@ first.
| Modifier and Type | Interface and Description |
|---|---|
static class |
GoogleLoggingApi.NoOp<API extends GoogleLoggingApi<API>>
An implementation of
GoogleLoggingApi which does nothing and discards all parameters. |
| Modifier and Type | Method and Description |
|---|---|
<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.
|
atMostEvery, 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, withStackTrace<T> API with(com.google.common.flogger.MetadataKey<T> key, @Nullable T value)
This 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(...)).
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-opjava.lang.NullPointerException - if the given key is nullMetadataKey