log4r-gelf 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,10 @@ module Log4r
30
30
  @notifier.level_mapping = hash['level_mapping'] || :direct
31
31
  end
32
32
 
33
+ def format_attribute(value)
34
+ value.inspect
35
+ end
36
+
33
37
  private
34
38
 
35
39
  def canonical_log(logevent)
@@ -43,7 +47,7 @@ module Log4r
43
47
  if logevent.data.respond_to?(:backtrace)
44
48
  trace = logevent.data.backtrace
45
49
  if trace
46
- opts["_exception"] = "#{logevent.data.class}"
50
+ opts["_exception"] = format_attribute(logevent.data.class)
47
51
  opts[:short_message] = "Caught #{logevent.data.class}: #{logevent.data.message}"
48
52
  opts[:full_message] = "Backtrace:\n" + trace.join("\n")
49
53
  opts[:file] = trace[0].split(":")[0]
@@ -61,7 +65,7 @@ module Log4r
61
65
  gdc = Log4r::GDC.get
62
66
  if gdc && gdc != $0
63
67
  begin
64
- opts["_global_context"] = gdc.inspect
68
+ opts["_global_context"] = format_attribute(gdc)
65
69
  rescue
66
70
  end
67
71
  end
@@ -69,7 +73,7 @@ module Log4r
69
73
  if Log4r::NDC.get_depth > 0
70
74
  Log4r::NDC.clone_stack.each_with_index do |x, i|
71
75
  begin
72
- opts["_nested_context_#{i}"] = x.inspect
76
+ opts["_nested_context_#{i}"] = format_attribute(x)
73
77
  rescue
74
78
  end
75
79
  end
@@ -79,7 +83,7 @@ module Log4r
79
83
  if mdc && mdc.size > 0
80
84
  mdc.each do |k, v|
81
85
  begin
82
- opts["_mapped_context_#{k}"] = v.inspect
86
+ opts["_mapped_context_#{k}"] = format_attribute(v)
83
87
  rescue
84
88
  end
85
89
  end
@@ -1,5 +1,5 @@
1
1
  module Log4r
2
2
  module Gelf
3
- VERSION = "0.8.4"
3
+ VERSION = "0.8.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log4r-gelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: