Skip to content

Commit

Permalink
fix logging #64
Browse files Browse the repository at this point in the history
  • Loading branch information
dejan committed Apr 7, 2014
1 parent 0d1aa61 commit 8dad1cb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion meta_request/lib/meta_request/log_interceptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def info(message = nil, &block)
super
end

def warn(message = nil, &block)
push_event(:warn, message)
super
end

def error(message = nil, &block)
push_event(:error, message)
super
Expand All @@ -22,10 +27,16 @@ def fatal(message = nil, &block)
push_event(:fatal, message)
super
end

def unknown(message = nil, &block)
push_event(:unknown, message)
super
end


private
def push_event(level, message)
dev_log = AppRequest.current && !AppRequest.current.events.empty? && caller[1] =~ /#{Rails.root}/
dev_log = AppRequest.current && caller[1] =~ /#{Rails.root}/
if dev_log
c = Callsite.parse(caller[1])
payload = {:message => message, :level => level, :line => c.line, :filename => c.filename, :method => c.method}
Expand Down

0 comments on commit 8dad1cb

Please sign in to comment.