class Generic
A generic event which can be used to represent structured data.
Definitions
def as_json(...)
Convert the event to a hash suitable for JSON serialization.
Signature
-
returns
Hash
The hash representation of the event.
Implementation
def as_json(...)
to_hash
end
def to_json(...)
Serialize the event to JSON.
Signature
-
returns
String
The JSON representation of the event.
Implementation
def to_json(...)
JSON.generate(as_json, ...)
end
def to_s
Convert the event to a string (JSON).
Signature
-
returns
String
The string representation of the event.
Implementation
def to_s
to_json
end
def emit(*arguments, **options)
Log the event using the given output interface.
Signature
-
parameter
arguments
Array
The arguments to log.
-
parameter
options
Hash
Additional options to pass to the logger output.
Implementation
def emit(*arguments, **options)
Console.call(*arguments, event: self, **options)
end