Sha256: 274cef3cf071f139b2b55d11c91860a019b11a0238c296c32e34d1b191451cb6

Contents?: true

Size: 733 Bytes

Versions: 128

Compression:

Stored size: 733 Bytes

Contents

# Taken from https://github.com/mperham/sidekiq/blob/7f882787e53d234042ff18099241403300a47585/lib/sidekiq/logging.rb
require 'time'
require 'logger'

module ActionSubscriber
  module Logging
    def self.initialize_logger(log_target = STDOUT)
      oldlogger = defined?(@logger) ? @logger : nil
      @logger = Logger.new(log_target)
      @logger.level = Logger::INFO
      oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging
      @logger
    end

    def self.logger
      defined?(@logger) ? @logger : initialize_logger
    end

    def self.logger=(log)
      @logger = (log ? log : Logger.new('/dev/null'))
    end

    def logger
      ::ActionSubscriber::Logging.logger
    end
  end
end

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
action_subscriber-5.3.3-java lib/action_subscriber/logging.rb
action_subscriber-5.3.3 lib/action_subscriber/logging.rb
action_subscriber-5.3.2-java lib/action_subscriber/logging.rb
action_subscriber-5.3.2 lib/action_subscriber/logging.rb
action_subscriber-5.3.1-java lib/action_subscriber/logging.rb
action_subscriber-5.3.1 lib/action_subscriber/logging.rb
action_subscriber-5.3.1.pre-java lib/action_subscriber/logging.rb
action_subscriber-5.3.1.pre lib/action_subscriber/logging.rb
action_subscriber-5.3.0-java lib/action_subscriber/logging.rb
action_subscriber-5.3.0 lib/action_subscriber/logging.rb
action_subscriber-5.2.4-java lib/action_subscriber/logging.rb
action_subscriber-5.2.4 lib/action_subscriber/logging.rb
action_subscriber-5.2.3-java lib/action_subscriber/logging.rb
action_subscriber-5.2.3 lib/action_subscriber/logging.rb
action_subscriber-5.2.2-java lib/action_subscriber/logging.rb
action_subscriber-5.2.2 lib/action_subscriber/logging.rb
action_subscriber-5.2.1-java lib/action_subscriber/logging.rb
action_subscriber-5.2.1 lib/action_subscriber/logging.rb
action_subscriber-5.2.0-java lib/action_subscriber/logging.rb
action_subscriber-5.2.0 lib/action_subscriber/logging.rb