Class Slf4jStructuredEventLog
- java.lang.Object
-
- org.apache.pulsar.structuredeventlog.slf4j.Slf4jStructuredEventLog
-
- All Implemented Interfaces:
StructuredEventLog
public class Slf4jStructuredEventLog extends java.lang.Object implements StructuredEventLog
-
-
Field Summary
Fields Modifier and Type Field Description static Slf4jStructuredEventLogINSTANCE
-
Constructor Summary
Constructors Constructor Description Slf4jStructuredEventLog()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventResourcesnewEventResources()Create an new event resources object, which can be used across multiple root events.EventnewRootEvent()Create a new root event.Eventunstash()Retrieves an event from the call stack.
-
-
-
Field Detail
-
INSTANCE
public static Slf4jStructuredEventLog INSTANCE
-
-
Method Detail
-
newRootEvent
public Event newRootEvent()
Description copied from interface:StructuredEventLogCreate a new root event. Root events occur in response to some external stimulus, such as a user request, a timer being triggered or a threshold being crossed. The level of the event is INFO by default. The root event will generate a new traceId, and will have a empty parent Id. If this information is provided, as can be the case with a user request, they can be set with Event#traceId(String) and Event#parentId(String).- Specified by:
newRootEventin interfaceStructuredEventLog
-
newEventResources
public EventResources newEventResources()
Description copied from interface:StructuredEventLogCreate an new event resources object, which can be used across multiple root events.- Specified by:
newEventResourcesin interfaceStructuredEventLog
-
unstash
public Event unstash()
Description copied from interface:StructuredEventLogRetrieves an event from the call stack. This can be used, along with Event#stash(), to bridge an event across an API without having to modify the API to pass the event object. For example, the child event, METHOD2, in the following example, will share the traceId with METHOD1, and METHOD1's id will be match the parentId of METHOD2.void method1() { Event e = logger.newRootEvent() .timed() .resource("foo", bar); e.stash(); unmodifiableMethod(); e.log(Events.METHOD1); } void unmodifiableMethod() { logger.unstash().newChildEvent().log(Events.METHOD2); }This should be used sparingly.- Specified by:
unstashin interfaceStructuredEventLog
-
-