Class: LogStruct::Log::Plain
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::Plain
- Extended by:
- T::Sig
- Includes:
- Interfaces::AdditionalDataField, Interfaces::CommonFields, Shared::MergeAdditionalDataFields, Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/plain.rb
Instance Attribute Summary collapse
-
#additional_data ⇒ Hash{String, Symbol => T.untyped}?
readonly
Returns the value of prop
additional_data. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#message ⇒ T.untyped
readonly
Event-specific fields.
-
#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:, additional_data: 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
Methods included from Shared::MergeAdditionalDataFields
Constructor Details
#initialize(source: Source::App, event: Event::Log, timestamp:, level: Level::Info, message:, additional_data: 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, T.untyped const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil |
Instance Attribute Details
#additional_data ⇒ Hash{String, Symbol => T.untyped}? (readonly)
Returns the value of prop additional_data.
|
|
# File '' const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil |
#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 ⇒ T.untyped (readonly)
Event-specific fields
|
|
# File '' const :message, T.untyped |
#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}
44 45 46 47 48 |
# File 'lib/log_struct/log/plain.rb', line 44 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::Message] = h end |