lib/lumber/lumber.rb in lumber-0.13.0 vs lib/lumber/lumber.rb in lumber-0.13.1
- old
+ new
@@ -117,9 +117,16 @@
rescue NameError
# The class hasn't been defined yet. No problem, we've registered the logger for when the class is created.
end
end
+ # Helper to make it easier to log context through log4r.yml
+ def format_mdc()
+ ctx = Log4r::MDC.get_context.collect {|k, v| k.to_s + "=" + v.to_s }.join(" ")
+ ctx.gsub!('%', '%%')
+ return ctx
+ end
+
private
# Adds a inheritance handler to Object so we can know to add loggers
# for classes as they get defined.
def self.register_inheritance_handler()
\ No newline at end of file