lib/rflow/logger.rb in rflow-1.2.0 vs lib/rflow/logger.rb in rflow-1.3.0a1

- old
+ new

@@ -64,9 +64,34 @@ internal_logger.warn "Changing log level from #{original_log_level} to #{new_log_level}" internal_logger.level = LNAMES.index new_log_level end + def dump_threads + Thread.list.each do |t| + info "Thread #{t.inspect}:" + t.backtrace.each {|b| info " #{b}" } + info '---' + end + info 'Thread dump complete.' + end + + def clone_logging_context + Log4r::NDC.clone_stack + end + + def apply_logging_context(context) + Log4r::NDC.inherit(context) + end + + def clear_logging_context + Log4r::NDC.clear + end + + def add_logging_context(context) + Log4r::NDC.push context + end + private def establish_internal_logger @internal_logger = Log4r::Logger.new(log_name).tap do |logger| logger.level = LNAMES.index log_level logger.trace = true