Class: ThreeScale::Backend::Logging::Worker

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/3scale/backend/logging/worker.rb

Class Method Summary collapse

Methods included from Configurable

#configuration, #configuration=, included

Class Method Details

.configure_logging(worker_class, workers_log_file) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/3scale/backend/logging/worker.rb', line 85

def configure_logging(worker_class, workers_log_file)
  log_file = workers_log_file || configuration.workers_log_file || '/dev/null'

  Logging.enable! on: worker_class.singleton_class, with: log_file do |logger|
    logger.formatter = logger_formatter

    # At this point, we've already configured the logger for Backend
    # (used in Listeners and rake tasks). We can reuse the notify proc
    # defined there.
    logger.define_singleton_method(:notify, backend_logger_notify_proc)
  end
end