Skip to content

Commit

Permalink
Add fixes to pass code climate
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon de Andres committed Apr 5, 2016
1 parent af5439e commit f80cc58
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lib/rollbar/logger.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
require "logger"
require 'logger'
require 'rollbar'

module Rollbar
# This class provides logger interface that can be used to replace
# the application logger and send all the log messages to Rollbar
#
# Usage:
# require 'rollbar/logger'
# logger = Rollbar::Logger.new
# logger.error('Error processing purchase')
#
# If using Rails, you can extend the Rails logger so messages are logged
# normally and also to Rollbar:
#
# Rails.logger.extend(ActiveSupport::Logger.broadcast(Rollbar::Logger.new))
class Logger < Logger
class Error < RuntimeError; end
class DatetimeFormatNotSupported < Error; end
Expand All @@ -11,7 +23,7 @@ def initialize
@level = ERROR
end

def add(severity, message = nil, progname = nil, &block)
def add(severity, message = nil, progname = nil)
return true if severity < @level

message ||= block_given? ? yield : progname
Expand All @@ -26,19 +38,19 @@ def <<(message)
end

def formatter=(_)
fail(FormatterNotSupported)
raise(FormatterNotSupported)
end

def formatter
fail(FormatterNotSupported)
raise(FormatterNotSupported)
end

def datetime_format=(_)
fail(DatetimeFormatNotSupported)
raise(DatetimeFormatNotSupported)
end

def datetime_format
fail(DatetimeFormatNotSupported)
raise(DatetimeFormatNotSupported)
end

# Returns a Rollbar::Notifier instance with the current global scope and
Expand Down

0 comments on commit f80cc58

Please sign in to comment.