module BBC::Cosmos::Logger
Constants
- DEFAULT_GELF_PORT
- DEFAULT_GELF_SERVER
- DEFAULT_LOG_LOCATION
- DEFAULT_MAXTIME
- DEFAULT_MAX_BACKUPS
- VERSION
Public Class Methods
create(id)
click to toggle source
# File lib/bbc/cosmos/logger.rb, line 46 def self.create(id) log = Log4r::Logger.new(id) # Add File Outputter Log4r::RollingFileOutputter.new( 'logfile', :formatter => SimpleFormatter, :filename => ENV['APP_LOG_LOCATION'] || DEFAULT_LOG_LOCATION, :max_backups => ENV['LOG_MAX_BACKUPS'] || DEFAULT_MAX_BACKUPS, :maxtime => ENV['LOG_MAXTIME'] || DEFAULT_MAXTIME, :trunc => true) log.add('logfile') # Add Gelf Outputter Log4r::GelfOutputter.new( 'gelfling', :formatter => SimpleFormatter, 'gelf_server' => ENV['GELF_SERVER'], 'gelf_port' => ENV['GELF_PORT']) log.add('gelfling') # Set Log Level log.level = level log end
level()
click to toggle source
# File lib/bbc/cosmos/logger.rb, line 29 def self.level case "#{ENV['APP_LOG_LEVEL']}".upcase when 'DEBUG' Log4r::DEBUG when 'INFO' Log4r::INFO when 'WARN' Log4r::WARN when 'ERROR' Log4r::ERROR when 'FATAL' Log4r::FATAL else Log4r::INFO end end