Sha256: b68c0298846f65b6fb5a9276dea7fd4a9100ba00dcb917073a88d727bdd905ae
Contents?: true
Size: 833 Bytes
Versions: 10
Compression:
Stored size: 833 Bytes
Contents
if defined?(Rails) require 'berkeley_library/logging/railtie' else require 'berkeley_library/logging/configurator' end module BerkeleyLibrary # Include this module to get access to a shared global logger. module Logging def logger Logging.logger end def logger=(v) Logging.logger = v end class << self def logger @logger ||= BerkeleyLibrary::Logging::Loggers.default_logger end def logger=(v) @logger = (ensure_logger(v) unless v.nil?) end private LOG_METHODS = %i[debug info warn error].freeze def ensure_logger(v) return v if (missing = LOG_METHODS.reject { |m| v.respond_to?(m) }).empty? raise ArgumentError, "Not a logger: #{v.inspect} does not respond to #{missing.join(', ')}" end end end end
Version data entries
10 entries across 10 versions & 1 rubygems