Class: Ixtlan::LoggerConfig
- Inherits:
-
Object
- Object
- Ixtlan::LoggerConfig
- Defined in:
- lib/ixtlan/logger_config.rb
Class Method Summary collapse
- .log_filebase(name) ⇒ Object
- .log_level(level = :warn) ⇒ Object
- .logger(appender, category, level = :warn) ⇒ Object
- .rolling_appender(name) ⇒ Object
Class Method Details
.log_filebase(name) ⇒ Object
25 26 27 |
# File 'lib/ixtlan/logger_config.rb', line 25 def self.log_filebase(name) ::Rails.root.join('log', name).to_s end |
.log_level(level = :warn) ⇒ Object
29 30 31 |
# File 'lib/ixtlan/logger_config.rb', line 29 def self.log_level(level = :warn) ENV['RAILS_ENV'] == 'production' ? level : :debug end |
.logger(appender, category, level = :warn) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ixtlan/logger_config.rb', line 18 def self.logger(appender, category, level = :warn) logger = Logging::Logger.new(category) logger.add_appenders(appender) logger.level = log_level(level) logger end |
.rolling_appender(name) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/ixtlan/logger_config.rb', line 9 def self.rolling_appender(name) appender = Ixtlan::RollingFile.new(name, :filename_base => log_filebase(name), :keep => 2, :date_pattern => '%Y-%m') appender.layout = Logging::Layouts::Pattern.new(:pattern => "%d [%-l] (%c) %m\n") appender end |