Module: PayPal::SDK::Core::Logging
- Included in:
- API::DataTypes::Base, Config, Util::HTTPHelper
- Defined in:
- lib/paypal-sdk/core/logging.rb
Overview
Include Logging module to provide logger functionality.
Configure logger
Logging.logger = Logger.new(STDERR)
Example
include Logger
logger.info "Debug message"
Class Method Summary collapse
-
.logger ⇒ Object
Get or Create configured logger based on the default environment configuration.
-
.logger=(logger) ⇒ Object
Set logger directly and clear the loggers cache.
Instance Method Summary collapse
- #log_event(message, &block) ⇒ Object
-
#logger ⇒ Object
Get logger object.
Class Method Details
.logger ⇒ Object
Get or Create configured logger based on the default environment configuration
28 29 30 |
# File 'lib/paypal-sdk/core/logging.rb', line 28 def logger @logger ||= Logger.new(STDERR) end |
Instance Method Details
#log_event(message, &block) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/paypal-sdk/core/logging.rb', line 18 def log_event(, &block) start_time = Time.now block.call ensure logger.info sprintf("[%.3fs] %s", Time.now - start_time, ) end |