Class: RubyChecker::Logger
- Inherits:
-
Object
- Object
- RubyChecker::Logger
- Defined in:
- lib/ruby_checker/logger.rb
Overview
Logger handles logging by delegating the task:
-
If we are in Rails, use the default Rails logger.
-
If we are not in Rails, simply use the ‘puts` method.
Instance Method Summary collapse
-
#debug(msg) ⇒ Object
debug logs the given message as a debug message.
-
#warn(msg) ⇒ Object
warn logs the given message as a warning.
Instance Method Details
#debug(msg) ⇒ Object
debug logs the given message as a debug message.
36 37 38 39 40 41 42 |
# File 'lib/ruby_checker/logger.rb', line 36 def debug(msg) if defined?(Rails) Rails.logger.tagged("ruby_checker") { Rails.logger.debug(msg) } else puts "[ruby_checker] Debug: #{msg}" end end |
#warn(msg) ⇒ Object
warn logs the given message as a warning.
27 28 29 30 31 32 33 |
# File 'lib/ruby_checker/logger.rb', line 27 def warn(msg) if defined?(Rails) Rails.logger.tagged("ruby_checker") { Rails.logger.warn(msg) } else puts "[ruby_checker] Warning: #{msg}" end end |