Class: Reporters::LoggerReporter
- Inherits:
-
Object
- Object
- Reporters::LoggerReporter
- Defined in:
- lib/grape_logging/reporters/logger_reporter.rb
Instance Method Summary collapse
-
#initialize(logger, formatter, log_level) ⇒ LoggerReporter
constructor
A new instance of LoggerReporter.
- #perform(params) ⇒ Object
Constructor Details
#initialize(logger, formatter, log_level) ⇒ LoggerReporter
Returns a new instance of LoggerReporter.
3 4 5 6 7 8 9 |
# File 'lib/grape_logging/reporters/logger_reporter.rb', line 3 def initialize(logger, formatter, log_level) @logger = logger || Logger.new(STDOUT) @log_level = log_level || :info if @logger.respond_to?(:formatter=) @logger.formatter = formatter || @logger.formatter || GrapeLogging::Formatters::Default.new end end |
Instance Method Details
#perform(params) ⇒ Object
11 12 13 |
# File 'lib/grape_logging/reporters/logger_reporter.rb', line 11 def perform(params) @logger.send(@log_level, params) end |