class Sherlog::Entry
Attributes
category[RW]
exceptions[RW]
level[RW]
message[RW]
origin[RW]
process[RW]
raw_content[RW]
stacktrace[RW]
time[RW]
Public Class Methods
new(params = {})
click to toggle source
# File lib/sherlog_holmes/entry.rb, line 28 def initialize(params = {}) params = params.dup @process = ParserProcess::new @time = params.delete :time if params[:time] @level = params.delete :level if params[:level] @category = params.delete :category if params[:category] @origin = params.delete :origin if params[:origin] @message = params.delete :message if params[:message] @raw_content = params.delete :raw_content if params[:raw_content] @exceptions = [params.delete(:exception)] if params[:exception] @exceptions ||= params.delete(:exceptions) if params[:exceptions] @exceptions ||= [] @stacktrace = [] @custom_attributes = params end
Public Instance Methods
<<(line)
click to toggle source
# File lib/sherlog_holmes/entry.rb, line 52 def <<(line) @message << $/ << line end
[](custom_attribute)
click to toggle source
# File lib/sherlog_holmes/entry.rb, line 56 def [](custom_attribute) @custom_attributes[custom_attribute.to_s] or @custom_attributes[custom_attribute.to_sym] end
exception()
click to toggle source
# File lib/sherlog_holmes/entry.rb, line 48 def exception @exceptions.first end
exception?()
click to toggle source
# File lib/sherlog_holmes/entry.rb, line 44 def exception? !@exceptions.empty? end
to_s()
click to toggle source
# File lib/sherlog_holmes/entry.rb, line 60 def to_s format = [] params = [] format << '%s' && params << time if time format << '%s' && params << level.to_s.ljust(7) if level format << '[%s]' && params << category if category format << '(%s)' && params << origin if origin format << '%s' && params << message if message string = format.join(' ') % params ([string] + @stacktrace).join($/) end