Class: LogStruct::Log::Sidekiq::Log
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::Sidekiq::Log
- Extended by:
- T::Sig
- Includes:
- Interfaces::AdditionalDataField, Interfaces::CommonFields, LogStruct::Log::Shared::MergeAdditionalDataFields, LogStruct::Log::Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/sidekiq/log.rb
Constant Summary
Constants included from LogStruct::Log::Shared::MergeAdditionalDataFields
LogStruct::Log::Shared::MergeAdditionalDataFields::RESERVED_KEYS
Instance Attribute Summary collapse
-
#additional_data ⇒ Hash{String, Symbol => T.untyped}?
readonly
Returns the value of prop
additional_data. -
#context ⇒ Hash{Symbol => T.untyped}?
readonly
Returns the value of prop
context. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#message ⇒ String?
readonly
Event-specific fields.
-
#process_id ⇒ Integer?
readonly
Returns the value of prop
process_id. -
#source ⇒ Source::Sidekiq
readonly
Shared/common fields.
-
#thread_id ⇒ Integer, ...
readonly
Returns the value of prop
thread_id. -
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp.
Instance Method Summary collapse
- #initialize(source: Source::Sidekiq, event: Event::Log, timestamp:, level: Level::Info, message: nil, context: nil, process_id: nil, thread_id: nil, additional_data: 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
Methods included from LogStruct::Log::Shared::MergeAdditionalDataFields
Constructor Details
#initialize(source: Source::Sidekiq, event: Event::Log, timestamp:, level: Level::Info, message: nil, context: nil, process_id: nil, thread_id: nil, additional_data: nil) ⇒ void
|
|
# File '' const :source, Source::Sidekiq, default: Source::Sidekiq const :event, Event, default: Event::Log const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :message, T.nilable(String), default: nil const :context, T.nilable(T::Hash[Symbol, T.untyped]), default: nil const :process_id, T.nilable(Integer), default: nil const :thread_id, T.nilable(T.any(Integer, String)), default: nil 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 |
#context ⇒ Hash{Symbol => T.untyped}? (readonly)
Returns the value of prop context.
|
|
# File '' const :context, T.nilable(T::Hash[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 ⇒ String? (readonly)
Event-specific fields
|
|
# File '' const :message, T.nilable(String), default: nil |
#process_id ⇒ Integer? (readonly)
Returns the value of prop process_id.
|
|
# File '' const :process_id, T.nilable(Integer), default: nil |
#source ⇒ Source::Sidekiq (readonly)
Shared/common fields
|
|
# File '' const :source, Source::Sidekiq, default: Source::Sidekiq |
#thread_id ⇒ Integer, ... (readonly)
Returns the value of prop thread_id.
|
|
# File '' const :thread_id, T.nilable(T.any(Integer, String)), default: nil |
#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}
48 49 50 51 52 53 54 55 |
# File 'lib/log_struct/log/sidekiq/log.rb', line 48 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::Message] = unless .nil? h[LogField::Context] = context unless context.nil? h[LogField::ProcessId] = process_id unless process_id.nil? h[LogField::ThreadId] = thread_id unless thread_id.nil? h end |