Class: RDKit::Logger
Instance Method Summary collapse
- #debug(message) ⇒ Object
- #info(message) ⇒ Object
- 
  
    
      #initialize(log_path = nil)  ⇒ Logger 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Logger. 
- #log(message) ⇒ Object
- #warn(message) ⇒ Object
Constructor Details
#initialize(log_path = nil) ⇒ Logger
Returns a new instance of Logger.
| 3 4 5 | # File 'lib/rdkit/logger.rb', line 3 def initialize(log_path=nil) @io = log_path ? File.open(log_path, 'a') : $stdout end | 
Instance Method Details
#debug(message) ⇒ Object
| 7 8 9 10 11 | # File 'lib/rdkit/logger.rb', line 7 def debug() return unless $DEBUG && ENV['RACK_ENV'] != 'test' log() end | 
#info(message) ⇒ Object
| 13 14 15 | # File 'lib/rdkit/logger.rb', line 13 def info() log() end | 
#log(message) ⇒ Object
| 21 22 23 24 25 26 27 28 29 30 | # File 'lib/rdkit/logger.rb', line 21 def log() case when Exception @io.puts .inspect @io.puts .backtrace.join("\n") else @io.puts end @io.flush end | 
#warn(message) ⇒ Object
| 17 18 19 | # File 'lib/rdkit/logger.rb', line 17 def warn() log() end |