FloggerApi

public interface FloggerApi<API extends FloggerApi<API>>

The basic logging API. An implementation of this API (or an extension of it) will be returned by any fluent logger, and forms the basis of the fluent call chain.

In typical usage each method in the API, with the exception of the terminal log() statements, will carry out some simple task (which may involve modifying the context of the log statement) and return the same API for chaining. The exceptions to this are:

  • Methods which return a NoOp implementation of the API in order to disable logging.
  • Methods which return an alternate API in order to implement context specific grammar (though these alternate APIs should always return the original logging API eventually).
A hypothetical example of a context specific grammar might be:

logger.at(WARNING).whenSystem().isLowOnMemory().log("");
In this example the whenSystem() method would return its own API with several context specific methods (isLowOnMemory(), isThrashing() etc...), however each of these sub-APIs must eventually return the original logging API.

See also

<a href="https://github.com/google/flogger/blob/cb9e836a897d36a78309ee8badf5cad4e6a2d3d8/api/src/main/java/com/google/common/flogger/LoggingApi.java">

Original Java code of Google Flogger

Inheritors

Types

Link copied to clipboard
public class NoOp<API extends FloggerApi<API>> implements FloggerApi<API>
An implementation of FloggerApi which does nothing and discards all parameters.

Functions

Link copied to clipboard
public abstract API atMostEvery(int n, TimeUnit unit)
Modifies the current log statement to be emitted at most once per specified time period.
Link copied to clipboard
public abstract API every(int n)
Modifies the current log statement to be emitted at most one-in-N times.
Link copied to clipboard
public abstract boolean isEnabled()
Returns true if logging is enabled at the level implied for this API, according to the current logger backend.
Link copied to clipboard
public abstract void log()
Terminal log statement when a message is not required.
public abstract void log(String msg)
Logs the given literal string without interpreting any argument placeholders.
public abstract void log(String msg, byte p1)
public abstract void log(String msg, char p1)
public abstract void log(String msg, int p1)
public abstract void log(String msg, long p1)
public abstract void log(String msg, short p1)
public abstract void log(String msg, boolean p1, boolean p2)
public abstract void log(String msg, boolean p1, byte p2)
public abstract void log(String msg, boolean p1, char p2)
public abstract void log(String msg, boolean p1, double p2)
public abstract void log(String msg, boolean p1, float p2)
public abstract void log(String msg, boolean p1, int p2)
public abstract void log(String msg, boolean p1, @Nullable() Object p2)
public abstract void log(String msg, boolean p1, long p2)
public abstract void log(String msg, boolean p1, short p2)
public abstract void log(String msg, byte p1, boolean p2)
public abstract void log(String msg, byte p1, byte p2)
public abstract void log(String msg, byte p1, char p2)
public abstract void log(String msg, byte p1, double p2)
public abstract void log(String msg, byte p1, float p2)
public abstract void log(String msg, byte p1, int p2)
public abstract void log(String msg, byte p1, @Nullable() Object p2)
public abstract void log(String msg, byte p1, long p2)
public abstract void log(String msg, byte p1, short p2)
public abstract void log(String msg, char p1, boolean p2)
public abstract void log(String msg, char p1, byte p2)
public abstract void log(String msg, char p1, char p2)
public abstract void log(String msg, char p1, double p2)
public abstract void log(String msg, char p1, float p2)
public abstract void log(String msg, char p1, int p2)
public abstract void log(String msg, char p1, @Nullable() Object p2)
public abstract void log(String msg, char p1, long p2)
public abstract void log(String msg, char p1, short p2)
public abstract void log(String msg, double p1, boolean p2)
public abstract void log(String msg, double p1, byte p2)
public abstract void log(String msg, double p1, char p2)
public abstract void log(String msg, double p1, double p2)
public abstract void log(String msg, double p1, float p2)
public abstract void log(String msg, double p1, int p2)
public abstract void log(String msg, double p1, @Nullable() Object p2)
public abstract void log(String msg, double p1, long p2)
public abstract void log(String msg, double p1, short p2)
public abstract void log(String msg, float p1, boolean p2)
public abstract void log(String msg, float p1, byte p2)
public abstract void log(String msg, float p1, char p2)
public abstract void log(String msg, float p1, double p2)
public abstract void log(String msg, float p1, float p2)
public abstract void log(String msg, float p1, int p2)
public abstract void log(String msg, float p1, @Nullable() Object p2)
public abstract void log(String msg, float p1, long p2)
public abstract void log(String msg, float p1, short p2)
public abstract void log(String msg, int p1, boolean p2)
public abstract void log(String msg, int p1, byte p2)
public abstract void log(String msg, int p1, char p2)
public abstract void log(String msg, int p1, double p2)
public abstract void log(String msg, int p1, float p2)
public abstract void log(String msg, int p1, int p2)
public abstract void log(String msg, int p1, @Nullable() Object p2)
public abstract void log(String msg, int p1, long p2)
public abstract void log(String msg, int p1, short p2)
public abstract void log(String msg, @Nullable() Object p1, boolean p2)
public abstract void log(String msg, @Nullable() Object p1, byte p2)
public abstract void log(String msg, @Nullable() Object p1, char p2)
public abstract void log(String msg, @Nullable() Object p1, double p2)
public abstract void log(String msg, @Nullable() Object p1, float p2)
public abstract void log(String msg, @Nullable() Object p1, int p2)
public abstract void log(String msg, @Nullable() Object p1, @Nullable() Object p2)
public abstract void log(String msg, @Nullable() Object p1, long p2)
public abstract void log(String msg, @Nullable() Object p1, short p2)
public abstract void log(String msg, long p1, boolean p2)
public abstract void log(String msg, long p1, byte p2)
public abstract void log(String msg, long p1, char p2)
public abstract void log(String msg, long p1, double p2)
public abstract void log(String msg, long p1, float p2)
public abstract void log(String msg, long p1, int p2)
public abstract void log(String msg, long p1, @Nullable() Object p2)
public abstract void log(String msg, long p1, long p2)
public abstract void log(String msg, long p1, short p2)
public abstract void log(String msg, short p1, boolean p2)
public abstract void log(String msg, short p1, byte p2)
public abstract void log(String msg, short p1, char p2)
public abstract void log(String msg, short p1, double p2)
public abstract void log(String msg, short p1, float p2)
public abstract void log(String msg, short p1, int p2)
public abstract void log(String msg, short p1, @Nullable() Object p2)
public abstract void log(String msg, short p1, long p2)
public abstract void log(String msg, short p1, short p2)
public abstract void log(String msg, @Nullable() Object p1, @Nullable() Object p2, @Nullable() Object p3)
public abstract void log(String msg, @Nullable() Object p1, @Nullable() Object p2, @Nullable() Object p3, @Nullable() Object p4)
public abstract void log(String msg, @Nullable() Object p1, @Nullable() Object p2, @Nullable() Object p3, @Nullable() Object p4, @Nullable() Object p5)
public abstract void log(String msg, @Nullable() Object p1, @Nullable() Object p2, @Nullable() Object p3, @Nullable() Object p4, @Nullable() Object p5, @Nullable() Object p6)
public abstract 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)
public abstract 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)
public abstract 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)
public abstract 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)
public abstract 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, Array<Object> rest)
Logs a message with formatted arguments (see log for details).
public abstract void log(String msg, @Nullable() Object p1)
Logs a formatted representation of the given parameter, using the specified message template.
Link copied to clipboard
public abstract void logVarargs(String message, @Nullable() Array<Object> varargs)
Logs a formatted representation of values in the given array, using the specified message template.
Link copied to clipboard
public abstract API onAverageEvery(int n)
Modifies the current log statement to be emitted with likelihood 1 in n.
Link copied to clipboard
public abstract API per(LoggingScopeProvider scopeProvider)
Aggregates stateful logging with respect to a scoped context determined by the given scope provider.
public abstract API per(@Nullable() @Nullable() Enum<? extends Object> key)
Aggregates stateful logging with respect to the given enum value.
public abstract API per<T>(@Nullable() @Nullable() T key, LogPerBucketingStrategy<? extends Object> strategy)
Aggregates stateful logging with respect to a given key.
Link copied to clipboard
public abstract API with(FloggerMetadataKey<Boolean> key)
Sets a boolean metadata key constant to true for this log statement in a structured way that is accessible to logger backends.
public abstract API with<T>(FloggerMetadataKey<T> key, @Nullable() @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.
Link copied to clipboard
public abstract API withCause(@Nullable() @Nullable() Throwable cause)
Associates a Throwable instance with the current log statement, to be interpreted as the cause of this statement.
Link copied to clipboard
public abstract API withInjectedLogSite(@Nullable() @Nullable() FloggerLogSite logSite)
Sets the log site for the current log statement.
public abstract API withInjectedLogSite(String internalClassName, String methodName, int encodedLineNumber, @Nullable() @Nullable() String sourceFileName)
Internal method not for public use.
Link copied to clipboard
public abstract API withStackTrace(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.