Sha256: 3146ba2a7661afdb06431f253d9147b9bf8d97ce31b2e164e1bf8a28e6abb80b

Contents?: true

Size: 685 Bytes

Versions: 10

Compression:

Stored size: 685 Bytes

Contents

module Eventboss
  class Logger
    class << self
      def logger
        Thread.current[:ah_eventboss_logger] ||= ::Logger.new(
          STDOUT,
          level: Eventboss.configuration.log_level
        )
      end

      def info(msg, tag = nil)
        return unless logger
        logger.info(tagged(msg, tag))
      end

      def debug(msg, tag = nil)
        return unless logger
        logger.debug(tagged(msg, tag))
      end

      def error(msg, tag = nil)
        return unless logger
        logger.error(tagged(msg, tag))
      end

      private

      def tagged(msg, tag)
        return msg if tag.nil?
        msg.prepend("[#{tag}] ")
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
eventboss-1.1.2 lib/eventboss/logger.rb
eventboss-1.1.1 lib/eventboss/logger.rb
eventboss-1.1.0 lib/eventboss/logger.rb
eventboss-1.0.6 lib/eventboss/logger.rb
eventboss-1.0.5 lib/eventboss/logger.rb
eventboss-1.0.4 lib/eventboss/logger.rb
eventboss-1.0.3 lib/eventboss/logger.rb
eventboss-1.0.2 lib/eventboss/logger.rb
eventboss-1.0.1 lib/eventboss/logger.rb
eventboss-1.0.0 lib/eventboss/logger.rb