module Solr4R::Logging
Constants
- DEFAULT_LOG_DEVICE
- DEFAULT_LOG_LEVEL
- DEFAULT_LOG_NAME
- NULL_LOGGER
Public Class Methods
set_log_level(logger, level = nil, default_level = nil)
click to toggle source
# File lib/solr4r/logging.rb, line 42 def set_log_level(logger, level = nil, default_level = nil) level ||= begin value = ENV.fetch('SOLR4R_LOG_LEVEL', '') value.empty? ? default_level || DEFAULT_LOG_LEVEL : value end logger.level = level.respond_to?(:upcase) ? Logger.const_get(level.upcase) : level end
Public Instance Methods
default_logger(options = options(), mod = self.class)
click to toggle source
# File lib/solr4r/logging.rb, line 56 def default_logger(options = options(), mod = self.class) logger = Logger.new(options.fetch(:log_device, mod::DEFAULT_LOG_DEVICE)) logger.progname = options.fetch(:log_name, mod::DEFAULT_LOG_NAME) Logging.set_log_level(logger, options[:log_level], mod::DEFAULT_LOG_LEVEL) logger end
forward_logger(object)
click to toggle source
# File lib/solr4r/logging.rb, line 65 def forward_logger(object) object.logger = logger object end