From 973d23b7b9165d3273fb93b34048f6a3da4693cb Mon Sep 17 00:00:00 2001 From: Walt Jones Date: Mon, 26 Aug 2024 13:22:57 -0400 Subject: [PATCH] initialize logger base class --- lib/rollbar/logger.rb | 24 +++--------------------- spec/rollbar/logger_spec.rb | 32 -------------------------------- 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/lib/rollbar/logger.rb b/lib/rollbar/logger.rb index 3a98a9a2..f3f9b0b1 100644 --- a/lib/rollbar/logger.rb +++ b/lib/rollbar/logger.rb @@ -17,12 +17,10 @@ module Rollbar class Logger < ::Logger class Error < RuntimeError; end - class DatetimeFormatNotSupported < Error; end - - class FormatterNotSupported < Error; end - def initialize - @level = ERROR + super(nil) + + self.level = ERROR end def add(severity, message = nil, progname = nil) @@ -39,22 +37,6 @@ def <<(message) error(message) end - def formatter=(_) - raise(FormatterNotSupported) - end - - def formatter - raise(FormatterNotSupported) - end - - def datetime_format=(_) - raise(DatetimeFormatNotSupported) - end - - def datetime_format - raise(DatetimeFormatNotSupported) - end - # Returns a Rollbar::Notifier instance with the current global scope and # with a logger writing to /dev/null so we don't have a infinite loop # when Rollbar.configuration.logger is Rails.logger. diff --git a/spec/rollbar/logger_spec.rb b/spec/rollbar/logger_spec.rb index 15b2319c..094d9b1c 100644 --- a/spec/rollbar/logger_spec.rb +++ b/spec/rollbar/logger_spec.rb @@ -85,38 +85,6 @@ end end - describe '#formatter=' do - it 'fails with FormatterNotSupported' do - expect do - subject.formatter = double - end.to raise_error(Rollbar::Logger::FormatterNotSupported) - end - end - - describe '#formatter' do - it 'fails with FormatterNotSupported' do - expect do - subject.formatter - end.to raise_error(Rollbar::Logger::FormatterNotSupported) - end - end - - describe '#datetime_format=' do - it 'fails with DatetimeFormatNotSupported' do - expect do - subject.datetime_format = double - end.to raise_error(Rollbar::Logger::DatetimeFormatNotSupported) - end - end - - describe '#datetime_format' do - it 'fails with DatetimeFormatNotSupported' do - expect do - subject.datetime_format - end.to raise_error(Rollbar::Logger::DatetimeFormatNotSupported) - end - end - describe '#rollbar' do it 'returns a Rollbar notifier with a logger pointing to /dev/null' do notifier = subject.rollbar