Interface EventLogger


  • public interface EventLogger
    A 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 Detail

      • createLogger

        static EventLogger createLogger​(String eventSource)
        Creates a new logger which defaults to writing JSON to stdout.
        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 for
        writer - the writer this logger will write to
        Returns:
        a new event logger
      • createAsyncLogger

        static EventLogger createAsyncLogger​(String eventSource,
                                             Executor executor)
        Creates a new asynchronous logger which defaults to writing JSON to stdout.
        Parameters:
        eventSource - the identifier for the source of the event this logger is used for
        executor - 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 for
        writer - the writer this logger will write to
        executor - the executor to execute the threads in
        Returns:
        a new event logger
      • getEventSource

        String getEventSource()
        Returns the source of event this logger is logging.
        Returns:
        the event source