Class: LogStruct::Log::Error
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::Error
- Extended by:
- T::Sig
- Includes:
- Interfaces::AdditionalDataField, Interfaces::CommonFields, Shared::MergeAdditionalDataFields, Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/error.rb
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(StandardError)
readonly
Event-specific fields.
-
#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. -
#source ⇒ Source
readonly
Shared/common fields.
-
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp.
Instance Method Summary collapse
- #initialize(source:, event: Event::Error, timestamp:, level: Level::Info, error_class:, message:, backtrace: nil, 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:, event: Event::Error, timestamp:, level: Level::Info, error_class:, message:, backtrace: nil, additional_data: nil) ⇒ void
|
|
# File '' const :source, Source const :event, Event, default: Event::Error const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :error_class, T.class_of(StandardError) const :message, String const :backtrace, T.nilable(T::Array[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 |
#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(StandardError) (readonly)
Event-specific fields
|
|
# File '' const :error_class, T.class_of(StandardError) |
#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 |
#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}
46 47 48 49 50 51 52 |
# File 'lib/log_struct/log/error.rb', line 46 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 end |