Module: ThreeScale::Backend::Logging

Included in:
Analytics::Kinesis::Adapter, Analytics::Kinesis::Job, Experiment, FailedJobsScheduler, Listener, Stats::Aggregator, Stats::Cleaner
Defined in:
lib/3scale/backend/logging.rb,
lib/3scale/backend/logging/logger.rb,
lib/3scale/backend/logging/worker.rb,
lib/3scale/backend/logging/external.rb,
lib/3scale/backend/logging/middleware.rb,
lib/3scale/backend/logging/external/impl.rb,
lib/3scale/backend/logging/external/resque.rb,
lib/3scale/backend/logging/middleware/writer.rb,
lib/3scale/backend/logging/external/impl/bugsnag.rb,
lib/3scale/backend/logging/external/impl/default.rb,
lib/3scale/backend/logging/external/impl/airbrake.rb,
lib/3scale/backend/logging/middleware/json_writer.rb,
lib/3scale/backend/logging/middleware/text_writer.rb

Overview

include this module to have a handy access to the default logger

Defined Under Namespace

Modules: External Classes: Logger, Middleware, Worker

Class Method Summary collapse

Class Method Details

.enable!(on:, with: [], as: :logger) {|logger| ... } ⇒ Object

Yields:

  • (logger)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/3scale/backend/logging.rb', line 14

def self.enable!(on:, with: [], as: :logger)
  logger = if with.empty?
             Backend.logger
           else
             Backend::Logging::Logger.new(*with)
           end

  # define the method before yielding
  on.send :define_method, as do
    logger
  end

  yield logger if block_given?
end

.included(base) ⇒ Object



10
11
12
# File 'lib/3scale/backend/logging.rb', line 10

def self.included(base)
  enable! on: base
end