Sha256: d7e4ec8725726e09e14c08e8902a1bc0cd2e0140ee8d2f4c39f0edb0184d0c75

Contents?: true

Size: 578 Bytes

Versions: 8

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true
require 'logger'

module Raven
  class Logger
    LOG_PREFIX = "** [Raven] ".freeze

    [
      :fatal,
      :error,
      :warn,
      :info,
      :debug
    ].each do |level|
      define_method level do |*args, &block|
        logger = Raven.configuration[:logger]
        logger = ::Logger.new(STDOUT) if logger.nil?
        return unless logger

        msg = args[0] # Block-level default args is a 1.9 feature
        msg ||= block.call if block

        logger.send(level, "sentry") { "#{LOG_PREFIX}#{msg}" }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sentry-raven-2.1.4 lib/raven/logger.rb
sentry-raven-2.1.3 lib/raven/logger.rb
sentry-raven-2.1.2 lib/raven/logger.rb
sentry-raven-2.1.1 lib/raven/logger.rb
sentry-raven-2.1.0 lib/raven/logger.rb
sentry-raven-2.0.2 lib/raven/logger.rb
sentry-raven-2.0.1 lib/raven/logger.rb
sentry-raven-2.0.0 lib/raven/logger.rb