lib/ougai/formatters/readable.rb in ougai-1.5.6 vs lib/ougai/formatters/readable.rb in ougai-1.5.7

- old
+ new

@@ -12,10 +12,11 @@ def initialize(opts = {}) super(opts[:app_name], opts[:hostname]) @trace_indent = opts[:trace_indent] || 4 @plain = opts[:plain] || false @excluded_fields = opts[:excluded_fields] || [] + @serialize_backtrace = true load_dependent end def call(severity, time, progname, data) msg = data.delete(:msg) @@ -26,10 +27,14 @@ @excluded_fields.each { |f| data.delete(f) } data_str = create_data_str(data) format_log_parts(dt, level, msg, err_str, data_str) end + def serialize_backtrace=(value) + raise RuntimeError, 'Not support serialize_backtrace' + end + protected def format_log_parts(datetime, level, msg, err, data) strs = ["[#{datetime}] #{level}: #{msg}"] strs.push(err) if err @@ -59,10 +64,10 @@ def create_err_str(data) return nil unless data.key?(:err) err = data.delete(:err) err_str = " #{err[:name]} (#{err[:message]}):" - err_str += "\n " + err[:stack] if err.key?(:stack) + err_str += "\n" + (" " * @trace_indent) + err[:stack] if err.key?(:stack) err_str end def create_data_str(data) return nil if data.empty?