Module: Logging
- Included in:
- NameChecker::FacebookChecker, NameChecker::RoboWhoisChecker, NameChecker::TwitterChecker, NameChecker::WhoisChecker
- Defined in:
- lib/name_checker/logging.rb
Class Method Summary collapse
-
.infer_level(level = nil) ⇒ Object
infer a suitable Log level from the ENVIRONMENT variable Can pass in an environment value for testing purposes.
- .logger(log_to = STDOUT) ⇒ Object
Instance Method Summary collapse
Class Method Details
.infer_level(level = nil) ⇒ Object
infer a suitable Log level from the ENVIRONMENT variable Can pass in an environment value for testing purposes
18 19 20 21 22 23 24 25 |
# File 'lib/name_checker/logging.rb', line 18 def self.infer_level(level = nil) level = level || NameChecker.configuration.log_level case level when 'debug' then Logger::DEBUG when 'warn' then Logger::WARN else Logger::INFO # default end end |
.logger(log_to = STDOUT) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/name_checker/logging.rb', line 8 def self.logger(log_to = STDOUT) unless @logger @logger = Logger.new(log_to) @logger.level = Logging.infer_level end @logger end |