officescripts-logging-framework
    Preparing search index...

    Interface LogEvent

    Interface for all log events to be sent to appenders. Defines the structure of a log event and is intended to be immutable.

    • The layout of the event is not defined in this interface. Instead, it is defined via appenders (see AbstractAppender.getLayout/AbstractAppender.setLayout) is used to configure the core content formatting of the log event output. All appenders (listeners) will output the same formatted log content, ensuring consistency. Appenders may apply their own additional presentation (e.g., colors or styles) without altering the event message itself.
    • Implementations of this interface (including user extensions) must ensure all properties are assigned during construction and remain immutable.
    • Framework code may validate any object passed as a LogEvent to ensure all invariants hold. If you implement this interface directly, you are responsible for upholding these invariants.
    • LOG_EVENT for the enumeration of log event types.
    • Layout for the layout used to format log events before sending them to appenders.
    • Appender for the interface that handles sending log events to output channels.
    interface LogEvent {
        extraFields: LogEventExtraFields;
        message: string;
        timestamp: Date;
        type: LOG_EVENT;
        toString(): string;
    }

    Implemented by

    Index

    Properties

    extraFields: LogEventExtraFields

    Additional metadata for the log event, for extension and contextual purposes. This field is immutable and must be a plain object. Intended for extensibility—avoid storing sensitive or large data here.

    message: string

    The log message to be sent to the appenders. This field is immutable. It must not be null, undefined, or an empty string.

    timestamp: Date

    The timestamp when the event was created. This field is immutable and must be a valid Date instance.

    type: LOG_EVENT

    The event type from the LOG_EVENT enum. This field is immutable and must be set at construction.

    Methods

    • Returns a string representation of the log event in a human-readable, single-line format, including all relevant fields. It is expected to be implemented in a standardized way across all implementations.

      Returns string

      A string representation of the log event.