Module: JustimmoClient::Logging Private
- Included in:
- Caching, OptionParser, V1::Currency, V1::JustimmoBase, V1::JustimmoInterface, V1::JustimmoRequest, V1::XML::JustimmoRepresenter
- Defined in:
- lib/justimmo_client/core/logging.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Logging support
Class Attribute Summary collapse
-
.logger ⇒ Logger
private
Use the Rails or default logger if none is set.
Class Method Summary collapse
- .default_logger ⇒ Object private
-
.rails_logger ⇒ Logger?
private
The Ruby on Rails logger.
Instance Method Summary collapse
- #logger ⇒ Object (also: #log) private
Class Attribute Details
.logger ⇒ Logger
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Use the Rails or default logger if none is set.
14 15 16 |
# File 'lib/justimmo_client/core/logging.rb', line 14 def logger @logger ||= rails_logger || default_logger end |
Class Method Details
.default_logger ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/justimmo_client/core/logging.rb', line 20 def default_logger logger = Logger.new($stdout) logger.level = JustimmoClient::Config.debug ? Logger::DEBUG : Logger::INFO logger.datetime_format = "%Y-%m-%d %H:%M:%S" logger.progname = "JustimmoClient" logger.formatter = proc do |severity, datetime, progname, | "[#{format("%-5s", severity)}] #{datetime} #{progname} #{}\n" end logger end |
.rails_logger ⇒ Logger?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The Ruby on Rails logger
33 34 35 36 37 |
# File 'lib/justimmo_client/core/logging.rb', line 33 def rails_logger if ("true" == ENV.fetch("JUSTIMMO_USE_RAILS_LOGGER", "true")) && defined?(::Rails) ::Rails&.logger end end |