class Piper::LogRec
Piper::LogRec
is a class for creating JSON log records for Piper
Push Cache server.
Attributes
kind[R]
tid[RW]
what[RW]
when[RW]
where[RW]
who[RW]
Public Class Methods
new(level, what, tid=nil, where=nil)
click to toggle source
# File lib/piper/logrec.rb, line 33 def initialize(level, what, tid=nil, where=nil) @kind = 'Log' if level.is_a?(Integer) @level = level else @level = @@level_map[level] end @who = @@who if where.nil? loc = caller_locations(2,1)[0] @where = "#{File.basename(loc.path)}:#{loc.lineno}" else @where = where end @what = what @when = Time.now @when.gmtime unless @when.gmt? @tid = tid end
who()
click to toggle source
# File lib/piper/logrec.rb, line 23 def self.who() return @@who end
Public Instance Methods
to_s()
click to toggle source
# File lib/piper/logrec.rb, line 53 def to_s() Oj.dump(self, :mode => :compat, :time_format => :unix) end