LogSiteMap

public abstract class LogSiteMap<V>

Provides per log site state for stateful fluent logging operations (e.g. rate limiting).

A log site map allows a logging API to efficiently, and safely, retrieve mutable log site state. This state can then be updated according to the current log statement.

Note that values held in this map are expected to be mutable and must still be thread safe themselves (the map protects only from concurrent lookup, not concurrent modification of the state itself). It is also strongly advised that all implementations of log site state avoid using locking (e.g. "synchronized" data structres) due to the risk of causing not trivial and potentially harmful thread contention bottlenecks during logging.

This class is intended only for use by fluent logging APIs (subclasses of LogContext and only used in the postProcess method, which supplies the key appropriate for the current log statement.

Parameters

<V>

The value type in the map.

See also

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

Original Java code of Google Flogger

Constructors

Link copied to clipboard
protected void LogSiteMap()

Functions

Link copied to clipboard
public final V get(LogSiteKey key, Metadata metadata)
Returns the mutable, thread safe, log site state for the given key to be read or updated during the postProcess method.
Link copied to clipboard
protected abstract V initialValue()
Implemented by subclasses to provide a new value for a newly added keys.