Module: Concurrent::Concern::Logging
Overview
Include where logging is needed
Constant Summary
-
SEV_LABEL =
# File 'lib/concurrent-ruby/concurrent/concern/logging.rb', line 12%w[DEBUG INFO WARN ERROR FATAL ANY].freeze
Instance Method Summary
-
#log(level, progname, message = nil, &block)
Logs through Concurrent.global_logger, it can be overridden by setting @logger.
Instance Method Details
#log(level, progname, message = nil, &block)
Logs through Concurrent.global_logger, it can be overridden by setting @logger
# File 'lib/concurrent-ruby/concurrent/concern/logging.rb', line 19
def log(level, progname, = nil, &block) logger = if defined?(@logger) && @logger @logger else Concurrent.global_logger end logger.call level, progname, , &block rescue => error $stderr.puts "`Concurrent.global_logger` failed to log #{[level, progname, , block]}\n" + "#{error.} (#{error.class})\n#{error.backtrace.join "\n"}" end