Constructs a new LogEventImpl
instance.
Validates the input parameters to ensure they conform to expected types and constraints.
The message to log.
The type of the log event (from LOG_EVENT
enum).
Optional
extraFields: LogEventExtraFields(Optional) Additional fields for the log event, can include strings, numbers, dates, or functions.
(Optional) The timestamp of the event, defaults to current time.
ScriptError if validation fails:
type
is not a valid LOG_EVENT
enum value.message
is not a non-empty string.timestamp
is not a valid Date
.extraFields
is not a plain object or contains reserved keys.extraFields
property allows for extensibility, enabling additional metadata to be attached to log events.Gets the extra fields of the log event.
Returns a shallow copy of custom fields for this event. These are immutable (Object.freeze
),
but if you allow object values in the future, document that deep mutation is not prevented.
The message of the log event (immutable).
The timestamp of the log event (immutable).
The event type from LOG_EVENT
enum (immutable).
A string representation of the log event in standard toString
format
Static
eventReturns a standardized label for the given log event.
The event type from LOG_EVENT
enum.
A string label, e.g., [INFO]
, [ERROR]
.
Static
validate
Implements the
LogEvent
interface, providing a concrete representation of a log event. It includes properties for the event type, message, timestamp and additional extra fields, along with validation methods.Remarks
extraFields
property allows for extensibility, enabling additional metadata to be attached to log events.toString()
method provides a standardized string representation of the log event.See