Sha256: 22bb2a7c684715a7ab45112e68bd3cd27ef5bc16fc5db3cd01047a85d3574986

Contents?: true

Size: 1.16 KB

Versions: 120

Compression:

Stored size: 1.16 KB

Contents

require 'logger'

module Concurrent
  module Concern

    # Include where logging is needed
    #
    # @!visibility private
    module Logging
      include Logger::Severity

      # Logs through {Concurrent.global_logger}, it can be overridden by setting @logger
      # @param [Integer] level one of Logger::Severity constants
      # @param [String] progname e.g. a path of an Actor
      # @param [String, nil] message when nil block is used to generate the message
      # @yieldreturn [String] a message
      def log(level, progname, message = nil, &block)
        #NOTE: Cannot require 'concurrent/configuration' above due to circular references.
        #      Assume that the gem has been initialized if we've gotten this far.
        logger = if defined?(@logger) && @logger
                   @logger
                 else
                   Concurrent.global_logger
                 end
        logger.call level, progname, message, &block
      rescue => error
        $stderr.puts "`Concurrent.configuration.logger` failed to log #{[level, progname, message, block]}\n" +
          "#{error.message} (#{error.class})\n#{error.backtrace.join "\n"}"
      end
    end
  end
end

Version data entries

120 entries across 106 versions & 25 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/concern/logging.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/concern/logging.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/concern/logging.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/concern/logging.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/concern/logging.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/concern/logging.rb
o-concurrent-ruby-1.1.13 lib/concurrent-ruby/concurrent/concern/logging.rb
o-concurrent-ruby-1.1.12 lib/concurrent-ruby/concurrent/concern/logging.rb
o-concurrent-ruby-1.1.11 lib/concurrent-ruby/concurrent/concern/logging.rb
concurrent-ruby-1.1.10 lib/concurrent-ruby/concurrent/concern/logging.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/concern/logging.rb