Class: Stackify::MsgObject
Instance Method Summary collapse
-
#initialize(level, msg, caller_str, trans_id = nil, log_uuid = nil, ex = nil) ⇒ MsgObject
constructor
A new instance of MsgObject.
- #to_h ⇒ Object
Constructor Details
#initialize(level, msg, caller_str, trans_id = nil, log_uuid = nil, ex = nil) ⇒ MsgObject
Returns a new instance of MsgObject.
3 4 5 6 |
# File 'lib/stackify/utils/msg_object.rb', line 3 def initialize level, msg, caller_str, trans_id=nil, log_uuid=nil, ex=nil @level, @msg, @caller_str, @ex = level, msg, caller_str, ex, @trans_id = trans_id, @log_uuid = log_uuid end |
Instance Method Details
#to_h ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/stackify/utils/msg_object.rb', line 8 def to_h { 'id' => @log_uuid, 'Msg' => @msg.to_s, 'data' => nil, 'Ex' => @ex.try(:to_h), 'Level' => @level.to_s.upcase!, #'Tags' => %w(ruby rails), 'EpochMs' => Time.now.to_f * 1000, 'Th' => Thread.current.object_id.to_s, 'TransID' => @trans_id, 'SrcMethod' => Stackify::Backtrace.method_name(@caller_str), 'SrcLine' => Stackify::Backtrace.line_number(@caller_str) } end |