log4r-gelf 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/log4r-gelf/gelf_outputter.rb +8 -4
- data/lib/log4r-gelf/version.rb +1 -1
- metadata +1 -1
@@ -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"] =
|
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
|
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
|
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
|
86
|
+
opts["_mapped_context_#{k}"] = format_attribute(v)
|
83
87
|
rescue
|
84
88
|
end
|
85
89
|
end
|
data/lib/log4r-gelf/version.rb
CHANGED