LogEvent class

A base class for creating log events, encapsulating information that can be logged.

This class provides the fundamental structure for log events, designed to be extended or used directly for custom logging solutions. It includes essential details like the event name, an optional message, and a parameters map that can be utilized to pass additional data relevant to the event.

Example:

var loginEvent = LogEvent(
  eventName: 'user_login_attempt',
  eventMessage: 'User attempted to log in.',
  parameters: {'username': 'exampleUser'}
);
logger.log('A user event', event: loginEvent);
Implementers

Constructors

LogEvent({required String eventName, String? eventMessage, Map<String, dynamic> parameters = const {}})
Constructs a LogEvent with a mandatory event name, an optional event message, and an optional map of parameters.

Properties

eventMessage String?
An optional message associated with the event, providing additional detail about the event's context or outcome.
final
eventName String
The name of the event. This is a required field and is used to identify the type of the event.
final
hashCode int
Generates a hash code based on the event name.
no setteroverride
parameters Map<String, dynamic>
A map of key-value pairs containing additional parameters that provide more context to the event. This is useful for passing additional data that may be relevant to specific logs.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
Converts the LogEvent to a map, which typically includes the event name and any parameters provided.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
Checks the equality of LogEvent instances based on the event name.
override