Class: LogStruct::Log::GoodJob::Error

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Includes:
Interfaces::CommonFields, Shared::SerializeCommon
Defined in:
lib/log_struct/log/good_job/error.rb

Instance Method Summary collapse

Methods included from Shared::SerializeCommon

#as_json, #serialize, #serialize_common

Methods included from Interfaces::CommonFields

#event, #source

Methods included from Interfaces::CommonFieldBase

#level, #serialize, #timestamp

Instance Method Details

#to_hObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/log_struct/log/good_job/error.rb', line 52

def to_h
  h = T.let({}, T::Hash[LogStruct::LogField, T.untyped])
  h[LogField::JobId] = job_id unless job_id.nil?
  h[LogField::JobClass] = job_class unless job_class.nil?
  h[LogField::QueueName] = queue_name unless queue_name.nil?
  h[LogField::Arguments] = arguments unless arguments.nil?
  h[LogField::Executions] = executions unless executions.nil?
  h[LogField::ErrorClass] = error_class
  h[LogField::ErrorMessage] = error_message
  h[LogField::DurationMs] = duration_ms unless duration_ms.nil?
  h[LogField::ProcessId] = process_id
  h[LogField::ThreadId] = thread_id
  h[LogField::ExceptionExecutions] = exception_executions unless exception_executions.nil?
  h[LogField::Backtrace] = backtrace unless backtrace.nil?
  h
end