Package org.wildfly.event.logger
Interface EventLogger
-
public interface EventLoggerA logger for various events such as access or audit logging.Note that a event source is an arbitrary string used to differentiate logging events. For example a web access event may have an even source of
web-access.- Author:
- James R. Perkins
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static EventLoggercreateAsyncLogger(String eventSource, Executor executor)static EventLoggercreateAsyncLogger(String eventSource, EventWriter writer, Executor executor)Creates a new asynchronous event logger.static EventLoggercreateLogger(String eventSource)static EventLoggercreateLogger(String eventSource, EventWriter writer)Creates a new event logger.StringgetEventSource()Returns the source of event this logger is logging.EventLoggerlog(Supplier<Map<String,Object>> event)Logs the event.EventLoggerlog(Map<String,Object> event)Logs the event.
-
-
-
Method Detail
-
createLogger
static EventLogger createLogger(String eventSource)
- Parameters:
eventSource- the identifier for the source of the event this logger is used for- Returns:
- a new event logger
-
createLogger
static EventLogger createLogger(String eventSource, EventWriter writer)
Creates a new event logger.- Parameters:
eventSource- the identifier for the source of the event this logger is used forwriter- the writer this logger will write to- Returns:
- a new event logger
-
createAsyncLogger
static EventLogger createAsyncLogger(String eventSource, Executor executor)
- Parameters:
eventSource- the identifier for the source of the event this logger is used forexecutor- the executor to execute the threads in- Returns:
- the new event logger
-
createAsyncLogger
static EventLogger createAsyncLogger(String eventSource, EventWriter writer, Executor executor)
Creates a new asynchronous event logger.- Parameters:
eventSource- the identifier for the source of the event this logger is used forwriter- the writer this logger will write toexecutor- the executor to execute the threads in- Returns:
- a new event logger
-
log
EventLogger log(Map<String,Object> event)
Logs the event.- Parameters:
event- the event to log- Returns:
- this logger
-
log
EventLogger log(Supplier<Map<String,Object>> event)
Logs the event.The supplier can lazily load the data. Note that in the cases of an asynchronous logger the data will be retrieved in a different thread.
- Parameters:
event- the event to log- Returns:
- this logger
-
getEventSource
String getEventSource()
Returns the source of event this logger is logging.- Returns:
- the event source
-
-