lib/dldinternet/mixlib/logging.rb in dldinternet-mixlib-logging-0.1.5 vs lib/dldinternet/mixlib/logging.rb in dldinternet-mixlib-logging-0.1.6
- old
+ new
@@ -33,13 +33,10 @@
code << <<-CODE
def #{name}?( ) true end
def #{name}( data = nil, trace = nil )
caller = Kernel.caller[3]
num = #{num}
- unless caller.match(%r(/chef/knife/chop)) # We assume anything else comes via Chef::Log ...
- num -= 1
- end
if num >= #{logger.level}
data = yield if block_given?
#log_event(::Logging::LogEvent.new(@name, num, caller, true))
log_event(::Logging::LogEvent.new(@name, num, data, trace.nil? ? @trace : trace))
end
@@ -110,11 +107,11 @@
module ClassMethods
end
attr :logger
- attr_reader :args
+ attr_reader :logger_args
attr_reader :step
attr_reader :TODO
# --------------------------------------------------------------------------------
def logTodo(msg)
@@ -142,11 +139,11 @@
end
end
# -----------------------------------------------------------------------------
def logStep(msg)
- logger = getLogger(@args, 'logStep')
+ logger = getLogger(@logger_args, 'logStep')
if logger
logger.step "Resource #{@step+=1}: #{msg} ..."
end
end
@@ -237,10 +234,10 @@
logger.remove_appenders appender
logger.add_appenders appender
logger.level = args[:log_level] ? args[:log_level] : :warn
logger.trace = true if args[:trace]
- @args = args
+ @logger_args = args
rescue Gem::LoadError
logger = FakeLogger.new
rescue => e
# not installed
logger = FakeLogger.new