Sha256: e0bc4c30f71a4ebde9fa34eee8fe9cd44e41857bf1432baab0ad5b829959f974

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 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

1 entries across 1 versions & 1 rubygems

Version Path
sentry-raven-1.2.3 lib/raven/logger.rb