Module: Chimps::Log
- Defined in:
- lib/chimps/utils.rb
Overview
Module for initializing the Chimps logger from configuration settings.
Class Method Summary collapse
-
.log_file ⇒ String, $stdout
Return either the path to the log file in Chimps.config or $stdout if the path is blank or equal to ‘-’.
-
.new_logger ⇒ Logger
Initialize a new Logger instance with the log level set by Chimps.verbose?.
Class Method Details
.log_file ⇒ String, $stdout
Return either the path to the log file in Chimps.config or $stdout if the path is blank or equal to ‘-’.
46 47 48 49 50 51 52 |
# File 'lib/chimps/utils.rb', line 46 def self.log_file if Chimps.config[:log] Chimps.config[:log].strip == '-' ? $stdout : Chimps.config[:log] else $stdout end end |
.new_logger ⇒ Logger
Initialize a new Logger instance with the log level set by Chimps.verbose?
34 35 36 37 38 39 40 |
# File 'lib/chimps/utils.rb', line 34 def self.new_logger require 'logger' Logger.new(log_file).tap do |log| log.progname = "Chimps" log.level = Chimps.verbose? ? Logger::INFO : Logger::WARN end end |