Class: LogStruct::Log::Ahoy
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::Ahoy
- Extended by:
- T::Sig
- Includes:
- Interfaces::CommonFields, Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/ahoy.rb
Instance Attribute Summary collapse
-
#ahoy_event ⇒ String
readonly
Returns the value of prop
ahoy_event. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#message ⇒ String
readonly
Event-specific fields.
-
#properties ⇒ Hash{Symbol => T.untyped}?
readonly
Returns the value of prop
properties. -
#source ⇒ Source::App
readonly
Shared/common fields.
-
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp.
Instance Method Summary collapse
- #initialize(source: Source::App, event: Event::Log, timestamp:, level: Level::Info, message:, ahoy_event:, properties: nil) ⇒ void constructor
- #to_h ⇒ Hash{LogStruct::LogField => T.untyped}
Methods included from Shared::SerializeCommon
#as_json, #serialize, #serialize_common
Methods included from Interfaces::CommonFields
Constructor Details
#initialize(source: Source::App, event: Event::Log, timestamp:, level: Level::Info, message:, ahoy_event:, properties: nil) ⇒ void
|
|
# File '' const :source, Source::App, default: Source::App const :event, Event, default: Event::Log const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :message, String const :ahoy_event, String const :properties, T.nilable(T::Hash[Symbol, T.untyped]), default: nil |
Instance Attribute Details
#ahoy_event ⇒ String (readonly)
Returns the value of prop ahoy_event.
|
|
# File '' const :ahoy_event, String |
#event ⇒ Event (readonly)
Returns the value of prop event.
|
|
# File '' const :event, Event, default: Event::Log |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info |
#message ⇒ String (readonly)
Event-specific fields
|
|
# File '' const :message, String |
#properties ⇒ Hash{Symbol => T.untyped}? (readonly)
Returns the value of prop properties.
|
|
# File '' const :properties, T.nilable(T::Hash[Symbol, T.untyped]), default: nil |
#source ⇒ Source::App (readonly)
Shared/common fields
|
|
# File '' const :source, Source::App, default: Source::App |
#timestamp ⇒ Time (readonly)
Returns the value of prop timestamp.
|
|
# File '' const :timestamp, Time, factory: -> { Time.now } |
Instance Method Details
#to_h ⇒ Hash{LogStruct::LogField => T.untyped}
41 42 43 44 45 46 47 |
# File 'lib/log_struct/log/ahoy.rb', line 41 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::Message] = h[LogField::AhoyEvent] = ahoy_event h[LogField::Properties] = properties unless properties.nil? h end |