4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/padrino_gelflogger/gelf_exception_logger.rb', line 4
def self.registered(app)
app.set :dump_errors, false app.error 500 do
raise "Pardino.logger must be set to Padrino::GelfLogger" unless logger.respond_to? :notify!
err = env['sinatra.error']
short_message = "#{err.class} - #{err.message}"
full_message = err.backtrace[0..2].join("\n ")
full_message += "\n\n---Params:\n"
params.each { |k,v| full_message += "\n#{k.inspect} => #{v.inspect}" }
logger.notify({
:short_message => short_message,
:full_message => full_message[0..2000], :level => GELF::Levels::FATAL
})
raise
end
end
|