Class: MangoPay::LogProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/mangopay/common/log_provider.rb

Overview

Provides logger objects.

Constant Summary collapse

ENABLE_LOGGING =
false
ENABLE_HTTP_LOGGING =
false

Class Method Summary collapse

Class Method Details

.provide(context) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mangopay/common/log_provider.rb', line 15

def provide(context)
  if needs_http_logger(context) && ENABLE_HTTP_LOGGING\
    || (!needs_http_logger(context) && ENABLE_LOGGING)
    logger = CustomLogger.new(STDOUT)
    logger.progname = context.name
    logger.formatter = CustomFormatter.new
    logger
  else
    VoidLogger.new
  end
end