Class: LogStruct::Log::Shrine::Metadata
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::Shrine::Metadata
- Extended by:
- T::Sig
- Defined in:
- lib/log_struct/log/shrine/metadata.rb
Instance Attribute Summary collapse
-
#duration_ms ⇒ Float?
readonly
Returns the value of prop
duration_ms. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#source ⇒ Source::Shrine
readonly
Shared/common fields.
-
#storage ⇒ Symbol
readonly
Event-specific fields.
-
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp.
Instance Method Summary collapse
- #initialize(source: Source::Shrine, event: Event::Metadata, timestamp:, level: Level::Info, storage:, duration_ms: nil) ⇒ void constructor
- #to_h ⇒ Hash{LogStruct::LogField => T.untyped}
Methods included from LogStruct::Log::Shared::SerializeCommon
#as_json, #serialize, #serialize_common
Methods included from Interfaces::CommonFieldBase
Constructor Details
#initialize(source: Source::Shrine, event: Event::Metadata, timestamp:, level: Level::Info, storage:, duration_ms: nil) ⇒ void
|
|
# File '' const :source, Source::Shrine, default: Source::Shrine const :event, Event, default: Event::Metadata const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :storage, Symbol const :duration_ms, T.nilable(Float), default: nil |
Instance Attribute Details
#duration_ms ⇒ Float? (readonly)
Returns the value of prop duration_ms.
|
|
# File '' const :duration_ms, T.nilable(Float), default: nil |
#event ⇒ Event (readonly)
Returns the value of prop event.
|
|
# File '' const :event, Event, default: Event::Metadata |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info |
#source ⇒ Source::Shrine (readonly)
Shared/common fields
|
|
# File '' const :source, Source::Shrine, default: Source::Shrine |
#storage ⇒ Symbol (readonly)
Event-specific fields
|
|
# File '' const :storage, Symbol |
#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 |
# File 'lib/log_struct/log/shrine/metadata.rb', line 41 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::Storage] = storage h[LogField::DurationMs] = duration_ms unless duration_ms.nil? h end |