public interface Event
| Modifier and Type | Method and Description |
|---|---|
Event |
atError()
Log this event at the error level.
|
Event |
atInfo()
Log this event at the info level (the default).
|
Event |
attr(String key,
Object value)
Add an attribute for the event.
|
Event |
attr(String key,
Supplier<String> value)
Add an attribute for the event using a supplier.
|
Event |
atWarn()
Log this event at the warn level.
|
Event |
exception(Throwable t)
Attach an exception to the event.
|
void |
log(Enum<?> event)
Log the event, using an enum as the message.
|
void |
log(String event)
Log the event, using a string.
|
Event |
newChildEvent()
Create a new child event.
|
Event |
parentId(String parentId)
Set the parent ID of the event.
|
Event |
resource(String key,
Object value)
Add a resource for the event.
|
Event |
resource(String key,
Supplier<String> value)
Add a resource for the event using a supplier.
|
Event |
resources(EventResources attrs)
Add resources for the event from an EventResources object.
|
Event |
sampled(Object samplingKey,
int duration,
TimeUnit unit)
Mark this event as sampled.
|
void |
stash()
Stash this log event to bridge across an unmodifiable API call.
|
Event |
timed()
Mark this event as timed.
|
Event |
traceId(String traceId)
Set the trace ID of the event.
|
Event newChildEvent()
Event traceId(String traceId)
traceId - the traceIdEvent parentId(String parentId)
parentId - the parentIdEvent timed()
Event e = logger.newRootEvent().timed(); // do something that takes time. e.log(Events.SOME_EVENT);
Event sampled(Object samplingKey, int duration, TimeUnit unit)
samplingKey - a key by which to scope the rate limitingduration - the duration for which one event will be loggedunit - the duration unitEvent resources(EventResources attrs)
resource(java.lang.String,java.lang.Object)Event resource(String key, Object value)
key - the key to identify the resourcevalue - the value which will be logged for the resource.
This is converted to a string before logging.Event resource(String key, Supplier<String> value)
key - the key to identify the resourcevalue - a supplier which returns the value to be logged for
this resourceresource(java.lang.String,java.lang.Object)Event attr(String key, Object value)
key - the key to identify the attributevalue - the value which will be logged for the attribute.
This is converted to a string, using Object#toString() before logging.Event attr(String key, Supplier<String> value)
key - the key to identify the attributevalue - a supplier which returns the value to be logged for
this attributeEvent exception(Throwable t)
t - the exceptionEvent atError()
Event atInfo()
Event atWarn()
void log(Enum<?> event)
event - the event message, in enum formvoid log(String event)
event - the event message.void stash()
StructuredEventLog.unstash()Copyright © 2017–2021 Apache Software Foundation. All rights reserved.