Closed ismith closed 10 years ago
:thumbsup:
Consider doing the require of the null logger in lib/stomp.rb. One place rather than two.
stomp.gemspec appears to be updated by user edit. Use:
rake gemspec
to auto generate and validate a currently complete gemspec file.
Ian,
Some thoughts,
Thanks, Paul
On Mon, Sep 23, 2013 at 6:59 PM, Guy M. Allard notifications@github.com wrote:
Consider doing the require of the null logger in lib/stomp.rb. One place rather than two.
stomp.gemspec appears to be updated by user edit. Use:
rake gemspec
to auto generate and validate a currently complete gemspec file.
— Reply to this email directly or view it on GitHub.
@gmallard Good call on moving the require. I regenerated the gemspec as noted.
@ppaul Moved Slogger as suggested, and made it inherit from NullLogger. Can't easily Marshal Slogger, I think, because Logger isn't marshallable - it's got IO in it. So I may have to take logger out of the params hash and just use attr_accessor, unless you have other suggestions.
This works:
class Slogger < Stomp::NullLogger
def initialize(init_parms = nil)
_init
@log.info('Logger initialization complete.')
end
def marshal_dump
[]
end
def marshal_load(array)
_init
end
def _init
@log = Logger::new(STDOUT)
@log.level = Logger::DEBUG
end
# ...etc
end
This lets us remove several instances of
if @logger && @logger.respond_to?(:some_method)
(https://gist.github.com/ppaul/6540400, #9)