Module: Readorder::Log
- Defined in:
- lib/readorder/log.rb
Class Method Summary collapse
- .console ⇒ Object
- .console=(level) ⇒ Object
- .console_layout ⇒ Object
- .init(options = {}) ⇒ Object
- .layout ⇒ Object
- .level ⇒ Object
- .level=(l) ⇒ Object
Class Method Details
.console ⇒ Object
27 28 29 |
# File 'lib/readorder/log.rb', line 27 def self.console Logging.appenders.stderr.level end |
.console=(level) ⇒ Object
31 32 33 |
# File 'lib/readorder/log.rb', line 31 def self.console=( level ) Logging.appenders.stderr.level = level end |
.console_layout ⇒ Object
50 51 52 53 54 55 |
# File 'lib/readorder/log.rb', line 50 def self.console_layout @console_layout ||= Logging::Layouts::Pattern.new( :pattern => "%d %5l : %m\n", :date_pattern => "%H:%M:%S" ) end |
.init(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/readorder/log.rb', line 12 def self.init( = {} ) appender = Logging.appenders.stderr appender.layout = self.console_layout if ['log-file'] then appender = ::Logging::Appenders::File.new( 'readorder', :filename => ['log-file'], :layout => self.layout ) end Readorder.logger.add_appenders( appender ) self.level = ['log-level'] || :info end |
.layout ⇒ Object
43 44 45 46 47 48 |
# File 'lib/readorder/log.rb', line 43 def self.layout @layout ||= Logging::Layouts::Pattern.new( :pattern => "[%d] %5l %6p %c : %m\n", :date_pattern => "%Y-%m-%d %H:%M:%S" ) end |
.level ⇒ Object
35 36 37 |
# File 'lib/readorder/log.rb', line 35 def self.level ::Logging::Logger[Readorder].level end |
.level=(l) ⇒ Object
39 40 41 |
# File 'lib/readorder/log.rb', line 39 def self.level=( l ) ::Logging::Logger[Readorder].level = l end |