Class: LogStruct::Log::ActionMailer
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::ActionMailer
- Extended by:
- T::Sig
- Includes:
- Interfaces::AdditionalDataField, Interfaces::CommonFields, MergeAdditionalDataFields, SerializeCommon
- Defined in:
- lib/log_struct/log/action_mailer.rb
Overview
Email log entry for structured logging
Constant Summary collapse
Instance Attribute Summary collapse
-
#additional_data ⇒ Hash{Symbol => T.untyped}
readonly
Returns the value of prop
additional_data
. -
#event ⇒ ActionMailerEvent
readonly
Returns the value of prop
event
. -
#from ⇒ String?
readonly
Returns the value of prop
from
. -
#level ⇒ Level
readonly
Returns the value of prop
level
. -
#source ⇒ Source::Mailer
readonly
Common fields.
-
#subject ⇒ String?
readonly
Returns the value of prop
subject
. -
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp
. -
#to ⇒ String, ...
readonly
Email-specific fields.
Instance Method Summary collapse
- #initialize(source: T.let(Source::Mailer, Source::Mailer), event:, timestamp:, level: T.let(Level::Info, Level), to: nil, from: nil, subject: nil, additional_data: {}) ⇒ void constructor
-
#serialize(strict = true) ⇒ Hash{Symbol => T.untyped}
Convert the log entry to a hash for serialization.
Methods included from MergeAdditionalDataFields
Methods included from SerializeCommon
Constructor Details
#initialize(source: T.let(Source::Mailer, Source::Mailer), event:, timestamp:, level: T.let(Level::Info, Level), to: nil, from: nil, subject: nil, additional_data: {}) ⇒ void
|
# File '' const :source, Source::Mailer, default: T.let(Source::Mailer, Source::Mailer) const :event, ActionMailerEvent const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: T.let(Level::Info, Level) const :to, T.nilable(T.any(String, T::Array[String])), default: nil const :from, T.nilable(String), default: nil const :subject, T.nilable(String), default: nil const :additional_data, T::Hash[Symbol, T.untyped], default: {} |
Instance Attribute Details
#additional_data ⇒ Hash{Symbol => T.untyped} (readonly)
Returns the value of prop additional_data
.
|
# File '' const :additional_data, T::Hash[Symbol, T.untyped], default: {} |
#event ⇒ ActionMailerEvent (readonly)
Returns the value of prop event
.
|
# File '' const :event, ActionMailerEvent |
#from ⇒ String? (readonly)
Returns the value of prop from
.
|
# File '' const :from, T.nilable(String), default: nil |
#level ⇒ Level (readonly)
Returns the value of prop level
.
|
# File '' const :level, Level, default: T.let(Level::Info, Level) |
#source ⇒ Source::Mailer (readonly)
Common fields
|
# File '' const :source, Source::Mailer, default: T.let(Source::Mailer, Source::Mailer) |
#subject ⇒ String? (readonly)
Returns the value of prop subject
.
|
# File '' const :subject, T.nilable(String), default: nil |
#timestamp ⇒ Time (readonly)
Returns the value of prop timestamp
.
|
# File '' const :timestamp, Time, factory: -> { Time.now } |
#to ⇒ String, ... (readonly)
Email-specific fields
|
# File '' const :to, T.nilable(T.any(String, T::Array[String])), default: nil |
Instance Method Details
#serialize(strict = true) ⇒ Hash{Symbol => T.untyped}
Convert the log entry to a hash for serialization
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/log_struct/log/action_mailer.rb', line 42 def serialize(strict = true) hash = serialize_common(strict) merge_additional_data_fields(hash) # Add email-specific fields if they're present hash[LOG_KEYS.fetch(:to)] = to if to hash[LOG_KEYS.fetch(:from)] = from if from hash[LOG_KEYS.fetch(:subject)] = subject if subject hash end |