lib/logging.rb in logging-1.7.2 vs lib/logging.rb in logging-1.8.0

- old
+ new

@@ -7,10 +7,11 @@ require 'yaml' require 'stringio' require 'fileutils' require 'little-plugger' +require 'multi_json' HAVE_SYSLOG = require? 'syslog' # # @@ -317,18 +318,19 @@ # formatting commands map to the following object methods # # * :string => to_s # * :inspect => inspect # * :yaml => to_yaml + # * :json => MultiJson.encode(obj) # # An +ArgumentError+ is raised if anything other than +:string+, # +:inspect+, +:yaml+ is passed to this method. # def format_as( f ) f = f.intern if f.instance_of? String - unless [:string, :inspect, :yaml].include? f + unless [:string, :inspect, :yaml, :json].include? f raise ArgumentError, "unknown object format '#{f}'" end module_eval "OBJ_FORMAT = :#{f}", __FILE__, __LINE__ self @@ -506,10 +508,11 @@ # Reset the Logging framework to it's uninitialized state def reset ::Logging::Repository.reset ::Logging::Appenders.reset ::Logging::ColorScheme.reset + ::Logging.clear_diagnostic_contexts(true) LEVELS.clear LNAMES.clear remove_instance_variable :@backtrace if defined? @backtrace remove_const :MAX_LEVEL_LENGTH if const_defined? :MAX_LEVEL_LENGTH remove_const :OBJ_FORMAT if const_defined? :OBJ_FORMAT @@ -532,9 +535,10 @@ require libpath('logging/stats') require libpath('logging/color_scheme') require libpath('logging/appenders') require libpath('logging/layouts') require libpath('logging/proxy') + require libpath('logging/diagnostic_context') require libpath('logging/config/configurator') require libpath('logging/config/yaml_configurator') require libpath('logging/rails_compat')