Class: LogStruct::Log::Sidekiq::Error
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::Sidekiq::Error
- Extended by:
- T::Sig
- Includes:
- Interfaces::AdditionalDataField, Interfaces::CommonFields, LogStruct::Log::Shared::MergeAdditionalDataFields, LogStruct::Log::Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/sidekiq/error.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. -
#backtrace ⇒ Array<String>?
readonly
Returns the value of prop
backtrace. -
#error_class ⇒ T.class_of(Exception)
readonly
Event-specific fields.
-
#error_context ⇒ String?
readonly
Returns the value of prop
error_context. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#message ⇒ String
readonly
Returns the value of prop
message. -
#queue_name ⇒ String?
readonly
Returns the value of prop
queue_name. -
#retry_count ⇒ Integer?
readonly
Returns the value of prop
retry_count. -
#source ⇒ Source::Sidekiq
readonly
Shared/common fields.
-
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp.
Instance Method Summary collapse
- #initialize(source: Source::Sidekiq, event: Event::Error, timestamp:, level: Level::Info, error_class:, message:, backtrace: nil, error_context: nil, queue_name: nil, retry_count: 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::Error, timestamp:, level: Level::Info, error_class:, message:, backtrace: nil, error_context: nil, queue_name: nil, retry_count: nil, additional_data: nil) ⇒ void
|
|
# File '' const :source, Source::Sidekiq, default: Source::Sidekiq const :event, Event, default: Event::Error const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :error_class, T.class_of(Exception) const :message, String const :backtrace, T.nilable(T::Array[String]), default: nil const :error_context, T.nilable(String), default: nil const :queue_name, T.nilable(String), default: nil const :retry_count, T.nilable(Integer), 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 |
#backtrace ⇒ Array<String>? (readonly)
Returns the value of prop backtrace.
|
|
# File '' const :backtrace, T.nilable(T::Array[String]), default: nil |
#error_class ⇒ T.class_of(Exception) (readonly)
Event-specific fields
|
|
# File '' const :error_class, T.class_of(Exception) |
#error_context ⇒ String? (readonly)
Returns the value of prop error_context.
|
|
# File '' const :error_context, T.nilable(String), default: nil |
#event ⇒ Event (readonly)
Returns the value of prop event.
|
|
# File '' const :event, Event, default: Event::Error |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info |
#message ⇒ String (readonly)
Returns the value of prop message.
|
|
# File '' const :message, String |
#queue_name ⇒ String? (readonly)
Returns the value of prop queue_name.
|
|
# File '' const :queue_name, T.nilable(String), default: nil |
#retry_count ⇒ Integer? (readonly)
Returns the value of prop retry_count.
|
|
# File '' const :retry_count, T.nilable(Integer), default: nil |
#source ⇒ Source::Sidekiq (readonly)
Shared/common fields
|
|
# File '' const :source, Source::Sidekiq, default: Source::Sidekiq |
#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}
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/log_struct/log/sidekiq/error.rb', line 50 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::ErrorClass] = error_class h[LogField::Message] = h[LogField::Backtrace] = backtrace unless backtrace.nil? h[LogField::ErrorContext] = error_context unless error_context.nil? h[LogField::QueueName] = queue_name unless queue_name.nil? h[LogField::RetryCount] = retry_count unless retry_count.nil? h end |