summaryrefslogtreecommitdiff
path: root/lib/mixlib/log.rb
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-10-13 21:58:36 -0700
committerDaniel DeLeo <dan@opscode.com>2010-10-13 21:59:26 -0700
commitf9fb2da9a9511c97a3552c153f77c3ff7c0754b5 (patch)
treec035d77d7ce3fa7c5fc49334f11c8b7c97d8ee0e /lib/mixlib/log.rb
parent42bfc83c42a384e1371b9d3bd4b3a48bbae3e9cf (diff)
downloadmixlib-log-f9fb2da9a9511c97a3552c153f77c3ff7c0754b5.tar.gz
[CHEF-1382] allow the logger to be reinitialized
Diffstat (limited to 'lib/mixlib/log.rb')
-rw-r--r--lib/mixlib/log.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/mixlib/log.rb b/lib/mixlib/log.rb
index e71eeb9..025018d 100644
--- a/lib/mixlib/log.rb
+++ b/lib/mixlib/log.rb
@@ -30,7 +30,7 @@ module Mixlib
# and creates a new one if it doesn't yet exist
##
def logger
- init
+ @logger || init
end
def logger=(value)
@@ -45,11 +45,9 @@ module Mixlib
#
# It also configures the Logger instance it creates to use the custom Mixlib::Log::Formatter class.
def init(*opts)
- if @logger.nil?
- @logger = (opts.empty? ? Logger.new(STDOUT) : Logger.new(*opts))
- @logger.formatter = Mixlib::Log::Formatter.new()
- @logger.level = Logger::WARN
- end
+ @logger = (opts.empty? ? Logger.new(STDOUT) : Logger.new(*opts))
+ @logger.formatter = Mixlib::Log::Formatter.new()
+ @logger.level = Logger::WARN
@logger
end
@@ -79,8 +77,8 @@ module Mixlib
# Passes any other method calls on directly to the underlying Logger object created with init. If
# this method gets hit before a call to Mixlib::Logger.init has been made, it will call
# Mixlib::Logger.init() with no arguments.
- def method_missing(method_symbol, *args)
- logger.send(method_symbol, *args)
+ def method_missing(method_symbol, *args, &block)
+ logger.send(method_symbol, *args, &block)
end
end