Class LogContext<LOGGER extends AbstractLogger<API>,API extends LoggingApi<API>>
- java.lang.Object
-
- com.google.common.flogger.LogContext<LOGGER,API>
-
- All Implemented Interfaces:
LogData,LoggingApi<API>
public abstract class LogContext<LOGGER extends AbstractLogger<API>,API extends LoggingApi<API>> extends Object implements LoggingApi<API>, LogData
The base context for a logging statement, which implements the base logging API.This class is an implementation of the base
LoggingApiinterface and acts as a holder for any state applied to the log statement during the fluent call sequence. The lifecycle of a logging context is very short; it is created by a logger, usually in response to a call to theAbstractLogger.at(Level)method, and normally lasts only as long as the log statement.This class should not be visible to normal users of the logging API and it is only needed when extending the API to add more functionality. In order to extend the logging API and add methods to the fluent call chain, the
LoggingApiinterface should be extended to add any new methods, and this class should be extended to implement them. A new logger class will then be needed to return the extended context.Logging contexts are not thread safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogContext.KeyThe predefined metadata keys used by the default logging API.-
Nested classes/interfaces inherited from interface com.google.common.flogger.LoggingApi
LoggingApi.NoOp<API extends LoggingApi<API>>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLogContext(Level level, boolean isForced)Creates a logging context with the specified level, and with a timestamp obtained from the configured loggingPlatform.protectedLogContext(Level level, boolean isForced, long timestampNanos)Creates a logging context with the specified level and timestamp.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected <T> voidaddMetadata(MetadataKey<T> key, T value)Adds the given key/value pair to this logging context.protected abstract APIapi()Returns the current API (which is just the concrete sub-type of this instance).APIatMostEvery(int n, TimeUnit unit)Modifies the current log statement to be emitted at most once per specified time period.APIevery(int n)Modifies the current log statement to be emitted at most one-in-N times.Object[]getArguments()Returns the arguments to be formatted with the message.LevelgetLevel()Returns the log level for the current log statement.ObjectgetLiteralArgument()Returns the single argument to be logged directly when no arguments were provided.protected abstract LOGGERgetLogger()Returns the logger which created this context.StringgetLoggerName()Returns the logger name (which is usually a canonicalized class name) ornullif not given.LogSitegetLogSite()Returns the log site data for the current log statement.protected abstract MessageParsergetMessageParser()Returns the message parser used for all log statements made through this logger.MetadatagetMetadata()Returns any additional metadata for this log statement.TemplateContextgetTemplateContext()Returns a template key for this log statement, ornullif the statement does not require formatting (in which case the message to be logged can be determined by callingLogData.getLiteralArgument()).longgetTimestampMicros()Deprecated.longgetTimestampNanos()Returns a nanosecond timestamp for the current log statement.booleanisEnabled()Returns true if logging is enabled at the level implied for this API, according to the current logger backend.voidlog()Terminal log statement when a message is not required.voidlog(String msg)Logs the given literal string without interpreting any argument placeholders.voidlog(String message, boolean p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, boolean p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, boolean p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, boolean p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, boolean p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, boolean p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, boolean p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, boolean p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, boolean p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, byte p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, char p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, double p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, float p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, int p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, long p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, short p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1)Logs a formatted representation of the given parameter, using the specified message template.voidlog(String message, @Nullable Object p1, boolean p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, byte p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, char p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, double p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, float p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, int p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, long p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, short p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, @Nullable Object p2)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String message, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7, @Nullable Object p8)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7, @Nullable Object p8, @Nullable Object p9)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7, @Nullable Object p8, @Nullable Object p9, @Nullable Object p10)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlog(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7, @Nullable Object p8, @Nullable Object p9, @Nullable Object p10, Object... rest)Logs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).voidlogVarargs(String message, @Nullable Object[] params)Logs a formatted representation of values in the given array, using the specified message template.protected abstract APInoOp()Returns the constant no-op logging API, which can be returned by fluent methods in extended logging contexts to efficiently disable logging.APIonAverageEvery(int n)Modifies the current log statement to be emitted with likelihood 1 inn.<T> APIper(@Nullable T key, LogPerBucketingStrategy<? super T> strategy)Aggregates stateful logging with respect to a givenkey.APIper(LoggingScopeProvider scopeProvider)Aggregates stateful logging with respect to a scoped context determined by the given scope provider.APIper(Enum<?> key)Aggregates stateful logging with respect to the given enum value.protected booleanpostProcess(@Nullable LogSiteKey logSiteKey)A callback which can be overridden to implement post processing of logging contexts prior to passing them to the backend.protected voidremoveMetadata(MetadataKey<?> key)Removes all key/value pairs with the specified key.protected booleanupdateRateLimiterStatus(@Nullable RateLimitStatus status)Callback to allow custom log contexts to apply additional rate limiting behaviour.booleanwasForced()Returns whether this log statement should be emitted regardless of its log level or any other properties.APIwith(MetadataKey<Boolean> key)Sets a boolean metadata key constant totruefor this log statement in a structured way that is accessible to logger backends.<T> APIwith(MetadataKey<T> key, @Nullable 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.APIwithCause(Throwable cause)Associates aThrowableinstance with the current log statement, to be interpreted as the cause of this statement.APIwithInjectedLogSite(LogSite logSite)Sets the log site for the current log statement.APIwithInjectedLogSite(String internalClassName, String methodName, int encodedLineNumber, @Nullable String sourceFileName)Internal method not for public use.APIwithStackTrace(StackSize size)Creates a synthetic exception and attaches it as the "cause" of the log statement as a way to provide additional context for the logging call itself.
-
-
-
Constructor Detail
-
LogContext
protected LogContext(Level level, boolean isForced)
Creates a logging context with the specified level, and with a timestamp obtained from the configured loggingPlatform.- Parameters:
level- the log level for this log statement.isForced- whether to force this log statement (seewasForced()for details).
-
LogContext
protected LogContext(Level level, boolean isForced, long timestampNanos)
Creates a logging context with the specified level and timestamp. This constructor is provided only for testing when timestamps need to be injected. In general, subclasses would only need to call this constructor when testing additional API methods which require timestamps (e.g. additional rate limiting functionality). Most unit tests for logger subclasses should not test the value of the timestamp at all, since this is already well tested elsewhere.- Parameters:
level- the log level for this log statement.isForced- whether to force this log statement (seewasForced()for details).timestampNanos- the nanosecond timestamp for this log statement.
-
-
Method Detail
-
api
protected abstract API api()
Returns the current API (which is just the concrete sub-type of this instance). This is returned by fluent methods to continue the fluent call chain.
-
getLogger
protected abstract LOGGER getLogger()
Returns the logger which created this context. This is implemented as an abstract method to save a field in every context.
-
noOp
protected abstract API noOp()
Returns the constant no-op logging API, which can be returned by fluent methods in extended logging contexts to efficiently disable logging. This is implemented as an abstract method to save a field in every context.
-
getMessageParser
protected abstract MessageParser getMessageParser()
Returns the message parser used for all log statements made through this logger.
-
getLevel
public final Level getLevel()
Description copied from interface:LogDataReturns the log level for the current log statement.
-
getTimestampMicros
@Deprecated public final long getTimestampMicros()
Deprecated.- Specified by:
getTimestampMicrosin interfaceLogData
-
getTimestampNanos
public final long getTimestampNanos()
Description copied from interface:LogDataReturns a nanosecond timestamp for the current log statement.- Specified by:
getTimestampNanosin interfaceLogData
-
getLoggerName
public final String getLoggerName()
Description copied from interface:LogDataReturns the logger name (which is usually a canonicalized class name) ornullif not given.- Specified by:
getLoggerNamein interfaceLogData
-
getLogSite
public final LogSite getLogSite()
Description copied from interface:LogDataReturns the log site data for the current log statement.- Specified by:
getLogSitein interfaceLogData
-
getTemplateContext
public final TemplateContext getTemplateContext()
Description copied from interface:LogDataReturns a template key for this log statement, ornullif the statement does not require formatting (in which case the message to be logged can be determined by callingLogData.getLiteralArgument()).- Specified by:
getTemplateContextin interfaceLogData
-
getArguments
public final Object[] getArguments()
Description copied from interface:LogDataReturns the arguments to be formatted with the message. Arguments exist when alog()method with a format message and separate arguments was invoked.- Specified by:
getArgumentsin interfaceLogData
-
getLiteralArgument
public final Object getLiteralArgument()
Description copied from interface:LogDataReturns the single argument to be logged directly when no arguments were provided.- Specified by:
getLiteralArgumentin interfaceLogData
-
wasForced
public final boolean wasForced()
Description copied from interface:LogDataReturns whether this log statement should be emitted regardless of its log level or any other properties.This allows extensions of
LogContextorLoggingBackendwhich implement additional filtering or rate-limiting fluent methods to easily check whether a log statement was forced. Forced log statements should behave exactly as if none of the filtering or rate-limiting occurred, including argument validity checks.Thus the idiomatic use of
wasForced()is:public API someFilteringMethod(int value) { if (wasForced()) { return api(); } if (value < 0) { throw new IllegalArgumentException("Bad things ..."); } // rest of method... }Checking for forced log statements before checking the validity of arguments provides a last-resort means to mitigate cases in which syntactically incorrect log statements are only discovered when they are enabled.
-
getMetadata
public final Metadata getMetadata()
Returns any additional metadata for this log statement.When called outside of the logging backend, this method may return different values at different times (ie, it may initially return a shared static "empty" metadata object and later return a different implementation). As such it is not safe to cache the instance returned by this method or to attempt to cast it to any particular implementation.
- Specified by:
getMetadatain interfaceLogData
-
addMetadata
protected final <T> void addMetadata(MetadataKey<T> key, T value)
Adds the given key/value pair to this logging context. If the key cannot be repeated, and there is already a value for the key in the metadata, then the existing value is replaced, otherwise the value is added at the end of the metadata.- Parameters:
key- the metadata key (seeLogData).value- the metadata value.
-
removeMetadata
protected final void removeMetadata(MetadataKey<?> key)
Removes all key/value pairs with the specified key. Note that this method does not resize any underlying backing arrays or other storage as logging contexts are expected to be short lived.- Parameters:
key- the metadata key (seeLogData).
-
postProcess
protected boolean postProcess(@Nullable LogSiteKey logSiteKey)
A callback which can be overridden to implement post processing of logging contexts prior to passing them to the backend.Basic Responsibilities
This method is responsible for:
- Performing any rate limiting operations specific to the extended API.
- Updating per log-site information (e.g. for debug metrics).
- Adding any additional metadata to this context.
- Returning whether logging should be attempted.
Implementations of this method must always call
super.postProcess()first with the given log site key:protected boolean postProcess(@Nullable LogSiteKey logSiteKey) { boolean shouldLog = super.postProcess(logSiteKey); // Handle rate limiting if present. // Add additional metadata etc. return shouldLog; }Log Site Keys
If per log-site information is needed during post-processing, it should be stored using a
LogSiteMap. This will correctly handle "specialized" log-site keys and remove the risk of memory leaks due to retaining unused log site data indefinitely.Note that the given
logSiteKeycan be more specific than theLogSiteof a log statement (i.e. a single log statement can have multiple distinct versions of its state). Seeper(Enum)for more information.If a log statement cannot be identified uniquely, then
logSiteKeywill benull, and this method must behave exactly as if the corresponding fluent method had not been invoked. On a system in which log site information is unavailable:
should behave exactly the same as:logger.atInfo().every(100).withCause(e).log("Some message");logger.atInfo().withCause(e).log("Some message");Rate Limiting and Skipped Logs
When handling rate limiting,
updateRateLimiterStatus(RateLimitStatus)should be called for each active rate limiter. This ensures that even if logging does not occur, the number of "skipped" log statements is recorded correctly and emitted for the next allowed log.If
postProcess()returnsfalsewithout updating the rate limit status, the log statement may not be counted as skipped. In some situations this is desired, but either way the extended logging API should make it clear to the user (via documentation) what will happen. However in most casespostProcess()is only expected to returnfalsedue to rate limiting.If rate limiters are used there are still situations in which
postProcess()can returntrue, but logging will not occur. This is due to race conditions around the resetting of rate limiter state. ApostProcess()method can "early exit" as soon asshouldLogis false, but should assume logging will occur while it remainstrue.If a method in the logging chain determines that logging should definitely not occur, it may choose to return the
NoOplogging API at that point. However this will bypass any post-processing, and no rate limiter state will be updated. This is sometimes desirable, but the API documentation should make it clear to the user as to which behaviour occurs.For example, level selector methods (such as
atInfo()) return theNoOpAPI for "disabled" log statements, and these have no effect on rate limiter state, and will not update the "skipped" count. This is fine because controlling logging via log level selection is not conceptually a form of "rate limiting".The default implementation of this method enforces the rate limits as set by
every(int)andatMostEvery(int, TimeUnit).- Parameters:
logSiteKey- used to lookup persistent, per log statement, state.- Returns:
- true if logging should be attempted (usually based on rate limiter state).
-
updateRateLimiterStatus
protected final boolean updateRateLimiterStatus(@Nullable RateLimitStatus status)
Callback to allow custom log contexts to apply additional rate limiting behaviour. This should be called from within an overridenpostProcess()method. Typically this is invoked after callingsuper.postProcess(logSiteKey), such as:protected boolean postProcess(@Nullable LogSiteKey logSiteKey) { boolean shouldLog = super.postProcess(logSiteKey); // Even if `shouldLog` is false, we still call the rate limiter to update its state. shouldLog &= updateRateLimiterStatus(CustomRateLimiter.check(...)); if (shouldLog) { // Maybe add additional metadata here... } return shouldLog; }See
RateLimitStatusfor more information on how to implement custom rate limiting in Flogger.- Parameters:
status- a rate limiting status, ornullif the rate limiter was not active.- Returns:
- whether logging will occur based on the current combined state of active rate limiters.
-
withInjectedLogSite
public final API withInjectedLogSite(LogSite logSite)
Description copied from interface:LoggingApiSets the log site for the current log statement. Explicit log site injection is very rarely necessary, since either the log site is injected automatically, or it is determined at runtime via stack analysis. The one use case where calling this method explicitly may be useful is when making logging helper methods, where some common project specific logging behavior is enshrined. For example, you can write:
and then code can do:public void logStandardWarningAt(LogSite logSite, String message, Object... args) { logger.atWarning() .withInjectedLogSite(logSite) .atMostEvery(5, MINUTES) .logVarargs(message, args); }
and elsewhere:import static com.google.common.flogger.LogSites.logSite;logStandardWarningAt(logSite(), "Badness"); ... logStandardWarningAt(logSite(), "More badness: %s", getData());Now each of the call sites for the helper method is treated as if it were in the logging API, and things like rate limiting work separately for each, and the location in the log statement will be the point at which the helper method was called.
It is very important to note that the
logSite()call can be very slow, since determining the log site can involve stack trace analysis. It is only recommended in cases where logging is expected to occur (e.g.WARNINGlevel or above). Luckily, there is typically no need to implement helper methods forFINElogging, since it's usually less structured and doesn't normally need to follow any specific "best practice" behavior.Note however that any stack traces generated by
LoggingApi.withStackTrace(StackSize)will still contain the complete stack, including the call to the logger itself inside the helper method.This method must only be explicitly called once for any log statement, and if this method is called multiple times the first invocation will take precedence. This is because log site injection (if present) is expected to occur just before the final
log()call and must be overrideable by earlier (explicit) calls. A null argument has no effect.- Specified by:
withInjectedLogSitein interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
logSite- Log site which uniquely identifies any per-log statement resources.
-
withInjectedLogSite
public final API withInjectedLogSite(String internalClassName, String methodName, int encodedLineNumber, @Nullable String sourceFileName)
Description copied from interface:LoggingApiInternal method not for public use. This method is only intended for use by the logger agent and related classes and should never be invoked manually.- Specified by:
withInjectedLogSitein interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
internalClassName- Slash separated class name obtained from the class constant pool.methodName- Method name obtained from the class constant pool.encodedLineNumber- line number and per-line log statement index encoded as a single 32-bit value. The low 16-bits is the line number (0 to 0xFFFF inclusive) and the high 16 bits is a log statement index to distinguish multiple statements on the same line (this becomes important if line numbers are stripped from the class file and everything appears to be on the same line).sourceFileName- Optional base name of the source file (this value is strictly for debugging and does not contribute to either equals() or hashCode() behavior).
-
isEnabled
public final boolean isEnabled()
Description copied from interface:LoggingApiReturns true if logging is enabled at the level implied for this API, according to the current logger backend. For example:if (logger.atFine().isEnabled()) { // Do non-trivial argument processing logger.atFine().log("Message: %s", value); }Note that if logging is enabled for a log level, it does not always follow that the log statement will definitely be written to the backend (due to the effects of other methods in the fluent chain), but if this method returns
falsethen it can safely be assumed that no logging will occur.This method is unaffected by additional methods in the fluent chain and should only ever be invoked immediately after the level selector method. In other words, the expression:
is incorrect because it will always behave identically to:logger.atFine().every(100).isEnabled()logger.atFine().isEnabled()Implementation Note
By avoiding passing a separateLevelat runtime to determine "loggability", this API makes it easier to coerce bytecode optimizers into doing "dead code" removal on sections guarded by this method.If a proxy logger class is supplied for which:
unconditionally returns the "NoOp" implementation of the API (in whichlogger.atFine()isEnabled()always returnsfalse), it becomes simple for bytecode analysis to determine that:
always evaluates tologger.atFine().isEnabled()false.- Specified by:
isEnabledin interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
with
public final <T> API with(MetadataKey<T> key, @Nullable T value)
Description copied from interface:LoggingApiAssociates a metadata key constant with a runtime value for this log statement in a structured way that is accessible to logger backends.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:- Keys that are recognised by specific logger backends (typically to control logging behaviour in some way).
- Key value pairs which are explicitly extracted from logs by tools.
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
valueisnull, this method is a no-op. This is useful for specifying conditional values (e.g. vialogger.atInfo().with(MY_KEY, getValueOrNull()).log(...)).- Specified by:
within interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
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-op- See Also:
MetadataKey
-
with
public final API with(MetadataKey<Boolean> key)
Description copied from interface:LoggingApiSets a boolean metadata key constant totruefor this log statement in a structured way that is accessible to logger backends.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:- Keys that are recognised by specific logger backends (typically to control logging behaviour in some way).
- Key value pairs which are explicitly extracted from logs by tools.
This method is just an alias for
with(key, true)to improve readability.- Specified by:
within interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
key- the boolean metadata key (expected to be a static constant)- See Also:
MetadataKey
-
per
public <T> API per(@Nullable T key, LogPerBucketingStrategy<? super T> strategy)
Description copied from interface:LoggingApiAggregates stateful logging with respect to a givenkey.Normally log statements with conditional behaviour (e.g. rate limiting) use the same state for each invocation (e.g. counters or timestamps). This method allows an additional qualifier to be given which allows for different conditional state for each unique qualifier.
This only makes a difference for log statements which use persistent state to control conditional behaviour (e.g.
atMostEvery()orevery()).This is the most general form of log aggregation and allows any keys to be used, but it requires the caller to have chosen a bucketing strategy. Where it is possible to refactor code to avoid passing keys from an unbounded space into the
per(...)method (e.g. by mapping cases to anEnum), this is usually preferable. When using this method, a bucketing strategy is needed to reduce the risk of leaking memory. Consider the alternate API:// Rate limit per unique error message ("No such file", "File corrupted" etc.). logger.atWarning().per(error.getMessage()).atMostEvery(30, SECONDS).log(...);A method such as the one above would need to store some record of all the unique messages it has seen in order to perform aggregation. This means that the API would suffer a potentially unbounded memory leak if a timestamp were included in the message (since all values would now be unique and need to be retained).
To fix (or at least mitigate) this issue, a
LogPerBucketingStrategyis passed to provide a mapping from "unbounded key space" (e.g. arbitrary strings) to a bounded set of "bucketed" values. In the case of error messages, you might implement a bucketing strategy to classify error messages based on the type of error.This method is most useful in helping to avoid cases where a rare event might never be logged due to rate limiting. For example, the following code will cause log statements with different types of
errorMessages to be rate-limited independently of each other.// Rate limit for each type of error (FileNotFoundException, CorruptedFileException etc.). logger.atInfo().per(error, byClass()).atMostEvery(30, SECONDS).log(...);If a user knows that the given
keyvalues really do form a strictly bounded set, theLogPerBucketingStrategy.knownBounded()strategy can be used, but it should always be documented as to why this is safe.The
keypassed to this method should always be a variable (passing a constant value has no effect). If anullkey is passed, this call has no effect (e.g. rate limiting will apply normally, without respect to any specific scope).If multiple aggregation keys are added to a single log statement, then they all take effect and logging is aggregated by the unique combination of keys passed to all "per" methods.
- Specified by:
perin interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
per
public final API per(Enum<?> key)
Description copied from interface:LoggingApiAggregates stateful logging with respect to the given enum value.Normally log statements with conditional behaviour (e.g. rate limiting) use the same state for each invocation (e.g. counters or timestamps). This method allows an additional qualifier to be given which allows for different conditional state for each unique qualifier.
This only makes a difference for log statements which use persistent state to control conditional behaviour (e.g.
atMostEvery()orevery()).This method is most useful in helping to avoid cases where a rare event might never be logged due to rate limiting. For example, the following code will cause log statements with different
taskTypes to be rate-limited independently of each other.// We want to rate limit logging separately for all task types. logger.at(INFO).per(taskType).atMostEvery(30, SECONDS).log("Start task: %s", taskSpec);The
keypassed to this method should always be a variable (passing a constant value has no effect). Ifnullis passed, this call has no effect (e.g. rate limiting will apply normally, without respect to any specific scope).If multiple aggregation keys are added to a single log statement, then they all take effect and logging is aggregated by the unique combination of keys passed to all "per" methods.
- Specified by:
perin interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
per
public API per(LoggingScopeProvider scopeProvider)
Description copied from interface:LoggingApiAggregates stateful logging with respect to a scoped context determined by the given scope provider.When
ScopedLoggingContextis used to create a context, it can be bound to aScopeType. For example:
whereScopedLoggingContexts.newContext(REQUEST).run(() -> scopedMethod(x, y, z));REQUESTdefines the scope type for the context in whichscopedMethod()is called. Within this context, the scope associated with theREQUESTtype can then be used to aggregate logging behavior:logger.atInfo().atMostEvery(5, SECONDS).per(REQUEST).log("Some message...");New scope types can be created for specific subtasks using
ScopeType.create("but it is recommended to use shared constants (such as") ScopeType.REQUEST) wherever feasible to avoid confusion.Note that in order for the request scope to be applied to a log statement, the
per(REQUEST)method must still be called; just being inside the request scope isn't enough.Unlike other
per()methods, this method is expected to be given a constant value. This is because the given value provides the current scope, rather than being the current scope.If a log statement using this method is invoked outside a context of the given type, this call has no effect (e.g. rate limiting will apply normally, without respect to any specific scope).
If multiple aggregation keys are added to a single log statement, then they all take effect and logging is aggregated by the unique combination of keys passed to all "per" methods.
- Specified by:
perin interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
scopeProvider- a constant used to defined the type of the scope in which logging is aggregated.
-
withCause
public final API withCause(Throwable cause)
Description copied from interface:LoggingApiAssociates aThrowableinstance with the current log statement, to be interpreted as the cause of this statement. Typically this method will be used from within catch blocks to log the caught exception or error. If the cause isnullthen this method has no effect.If this method is called multiple times for a single log statement, the last invocation will take precedence.
- Specified by:
withCausein interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
withStackTrace
public API withStackTrace(StackSize size)
Description copied from interface:LoggingApiCreates a synthetic exception and attaches it as the "cause" of the log statement as a way to provide additional context for the logging call itself. The exception created by this method is always of the typeLogSiteStackTrace, and its message indicates the stack size.If the
withCause(e)method is also called for the log statement (either before or after)withStackTrace(), the given exception becomes the cause of the synthetic exception.- Specified by:
withStackTracein interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
size- the maximum size of the stack trace to be generated.
-
every
public final API every(int n)
Description copied from interface:LoggingApiModifies the current log statement to be emitted at most one-in-N times. The specified count must be greater than zero and it is expected, but not required, that it is constant. In the absence of any other rate limiting, this method always allows the first invocation of any log statement to be emitted.Notes
If multiple rate limiters are used for a single log statement, that log statement will only be emitted once all rate limiters have reached their threshold, and when a log statement is emitted all the rate limiters are reset. In particular forevery(N)this means that logs need not always be emitted at multiples ofNif other rate limiters are active, though it will always be at leastN.When rate limiting is active, a
"skipped"count is added to log statements to indicate how many logs were disallowed since the last log statement was emitted.If this method is called multiple times for a single log statement, the last invocation will take precedence.
- Specified by:
everyin interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
n- the factor by which to reduce logging frequency.
-
onAverageEvery
public final API onAverageEvery(int n)
Description copied from interface:LoggingApiModifies the current log statement to be emitted with likelihood 1 inn. For example, insertingonAverageEvery(20)into a call chain results in approximately 5% as many messages being emitted as before. Unlike the other rate-limiting options, there is no guarantee about when the first such message will be emitted, though it becomes highly likely as the number of calls reaches several timesn.Notes
If multiple rate limiters are used for a single log statement, that log statement will only be emitted once all rate limiters have reached their threshold, and when a log statement is emitted all the rate limiters are reset. In particular foronAverageEvery(N)this means that logs may occurs less frequently than one-in-N if other rate limiters are active.When rate limiting is active, a
"skipped"count is added to log statements to indicate how many logs were disallowed since the last log statement was emitted.If this method is called multiple times for a single log statement, the last invocation will take precedence.
- Specified by:
onAverageEveryin interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
n- the factor by which to reduce logging frequency; a value of1has no effect.
-
atMostEvery
public final API atMostEvery(int n, TimeUnit unit)
Description copied from interface:LoggingApiModifies the current log statement to be emitted at most once per specified time period. The specified duration must not be negative, and it is expected, but not required, that it is constant. In the absence of any other rate limiting, this method always allows the first invocation of any log statement to be emitted.Note that for performance reasons
atMostEvery()is explicitly not intended to perform "proper" rate limiting to produce a limited average rate over many samples.Behaviour
A call toatMostEvery()will emit the current log statement if:
wherecurrentTimestampNanos >= lastTimestampNanos + unit.toNanos(n)currentTimestampNanosis the timestamp of the current log statement andlastTimestampNanosis a time stamp of the last log statement that was emitted.The effect of this is that when logging invocation is relatively infrequent, the period between emitted log statements can be higher than the specified duration. For example if the following log statement were called every 600ms:
logging would occur afterlogger.atFine().atMostEvery(2, SECONDS).log(...);0s,2.4sand4.8s(not4.2s), giving an effective duration of2.4sbetween log statements over time.Providing a zero length duration (ie,
n == 0) disables rate limiting and makes this method an effective no-op.Granularity
Because the implementation of this feature relies on a nanosecond timestamp provided by the backend, the actual granularity of the underlying clock used may vary, and it is possible to specify a time period smaller than the smallest visible time increment. If this occurs, then the effective rate limit applied to the log statement will be the smallest available time increment. For example, if the system clock granularity is 1 millisecond, and a log statement is called withatMostEvery(700, MICROSECONDS), the effective rate of logging (even averaged over long periods) could never be more than once every millisecond.Notes
If multiple rate limiters are used for a single log statement, that log statement will only be emitted once all rate limiters have reached their threshold, and when a log statement is emitted all the rate limiters are reset. So even if the rate limit duration has expired, it does not mean that logging will occur.When rate limiting is active, a
"skipped"count is added to log statements to indicate how many logs were disallowed since the last log statement was emitted.If this method is called multiple times for a single log statement, the last invocation will take precedence.
- Specified by:
atMostEveryin interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
n- the minimum number of time units between emitted log statementsunit- the time unit for the duration
-
log
public final void log()
Description copied from interface:LoggingApiTerminal log statement when a message is not required. Alogmethod must terminate all fluent logging chains and the no-argument method can be used if there is no need for a log message. For example:logger.at(INFO).withCause(error).log();However as it is good practice to give all log statements a meaningful log message, use of this method should be rare.
- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String msg)
Description copied from interface:LoggingApiLogs the given literal string without interpreting any argument placeholders.Important: This is intended only for use with hard-coded, literal strings which cannot contain user data. If you wish to log user generated data, you should do something like:
This serves to give the user data context in the log file but, more importantly, makes it clear which arguments may contain PII and other sensitive data (which might need to be scrubbed during logging). This recommendation also applies to all the overloadedlog("user data=%s", value);log()methods below.- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1)
Description copied from interface:LoggingApiLogs a formatted representation of the given parameter, using the specified message template. The message string is expected to contain argument placeholder terms appropriate to the logger's choice of parser.Note that printf-style loggers are always expected to accept the standard Java printf formatting characters (e.g. "%s", "%d" etc...) and all flags unless otherwise stated. Null arguments are formatted as the literal string
"null"regardless of formatting flags.- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
message- the message template string containing a single argument placeholder.
-
log
public final void log(String message, @Nullable Object p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7, @Nullable Object p8)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7, @Nullable Object p8, @Nullable Object p9)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7, @Nullable Object p8, @Nullable Object p9, @Nullable Object p10)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String msg, @Nullable Object p1, @Nullable Object p2, @Nullable Object p3, @Nullable Object p4, @Nullable Object p5, @Nullable Object p6, @Nullable Object p7, @Nullable Object p8, @Nullable Object p9, @Nullable Object p10, Object... rest)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, @Nullable Object p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, @Nullable Object p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, boolean p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, char p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, byte p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, short p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, int p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, long p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, float p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, boolean p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, char p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, byte p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, short p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, int p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, long p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, float p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
log
public final void log(String message, double p1, double p2)
Description copied from interface:LoggingApiLogs a message with formatted arguments (seeLoggingApi.log(String, Object)for details).- Specified by:
login interfaceLoggingApi<LOGGER extends AbstractLogger<API>>
-
logVarargs
public final void logVarargs(String message, @Nullable Object[] params)
Description copied from interface:LoggingApiLogs a formatted representation of values in the given array, using the specified message template.This method is only expected to be invoked with an existing varargs array passed in from another method. Unlike
LoggingApi.log(String, Object), which would treat an array as a single parameter, this method will unwrap the given array.- Specified by:
logVarargsin interfaceLoggingApi<LOGGER extends AbstractLogger<API>>- Parameters:
message- the message template string containing an argument placeholder for each element ofvarargs.params- the non-null array of arguments to be formatted.
-
-