Sha256: 42a477e87f929758253598ee8fa6faad89a3f009fa28f9b42654d22b03927931

Contents?: true

Size: 731 Bytes

Versions: 98

Compression:

Stored size: 731 Bytes

Contents

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

module ActivePublisher
  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
      ::ActivePublisher::Logging.logger
    end
  end
end

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
active_publisher-1.5.0.pre lib/active_publisher/logging.rb
active_publisher-1.4.2-java lib/active_publisher/logging.rb
active_publisher-1.4.2 lib/active_publisher/logging.rb
active_publisher-1.4.1-java lib/active_publisher/logging.rb
active_publisher-1.4.1 lib/active_publisher/logging.rb
active_publisher-1.4.1.pre-java lib/active_publisher/logging.rb
active_publisher-1.4.1.pre lib/active_publisher/logging.rb
active_publisher-1.4.0-java lib/active_publisher/logging.rb
active_publisher-1.4.0 lib/active_publisher/logging.rb
active_publisher-1.3.2 lib/active_publisher/logging.rb
active_publisher-1.3.2-java lib/active_publisher/logging.rb
active_publisher-1.3.1-java lib/active_publisher/logging.rb
active_publisher-1.3.1 lib/active_publisher/logging.rb
active_publisher-1.3.0-java lib/active_publisher/logging.rb
active_publisher-1.3.0 lib/active_publisher/logging.rb
active_publisher-1.2.6-java lib/active_publisher/logging.rb
active_publisher-1.2.6 lib/active_publisher/logging.rb
active_publisher-1.2.5-java lib/active_publisher/logging.rb
active_publisher-1.2.5 lib/active_publisher/logging.rb
active_publisher-1.2.4-java lib/active_publisher/logging.rb