-
Notifications
You must be signed in to change notification settings - Fork 24
Forward logs to Logentries
Toshimitsu Takahashi edited this page Sep 27, 2017
·
8 revisions
- Use
gem 'le'
Logging to Logentries in Ruby - Use
Le::Host
directly, notLe
require 'rubygems'
require 'ougai'
require 'le'
LOGENTRIES_TOKEN = 'xxxx-xxxx-xxxx-xxxx-xxxxxxx'
host = Le::Host.new(LOGENTRIES_TOKEN, false, false, true, ['', 10000], '', [false, ''], nil, false)
logger = Ougai::Logger.new(host)
logger.formatter.with_newline = false
logger.debug('Debug!', custom_data: { id: 1, name: 'something' })
begin
1 / 0
rescue => e
logger.error('error occurred', e)
end
#logger.close # relying on at_exit handler for shutdown, do not close