log4r-gelf 0.8.5 → 0.9.0
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 +10 -6
- data/lib/log4r-gelf/version.rb +1 -1
- metadata +2 -2
@@ -24,6 +24,10 @@ module Log4r
|
|
24
24
|
opts['facility'] = hash['facility'] if hash['facility']
|
25
25
|
opts['level'] = LEVELS_MAP[hash['level']] if hash['level']
|
26
26
|
|
27
|
+
@gdc_key = hash.has_key?('global_context_key') ? hash['global_context_key'] : "gdc"
|
28
|
+
@ndc_prefix = hash.has_key?('nested_context_prefix') ? hash['nested_context_prefix'] : "ndc_"
|
29
|
+
@mdc_prefix = hash.has_key?('mapped_context_prefix') ? hash['mapped_context_prefix'] : "mdc_"
|
30
|
+
|
27
31
|
@notifier = GELF::Notifier.new(server, port, max_chunk_size, opts)
|
28
32
|
# Only collect file/line if user turns on trace in log4r config
|
29
33
|
@notifier.collect_file_and_line = false
|
@@ -63,27 +67,27 @@ module Log4r
|
|
63
67
|
end
|
64
68
|
|
65
69
|
gdc = Log4r::GDC.get
|
66
|
-
if gdc && gdc != $0
|
70
|
+
if gdc && gdc != $0 && @gdc_key
|
67
71
|
begin
|
68
|
-
opts["
|
72
|
+
opts["_#{@gdc_key}"] = format_attribute(gdc)
|
69
73
|
rescue
|
70
74
|
end
|
71
75
|
end
|
72
76
|
|
73
|
-
if Log4r::NDC.get_depth > 0
|
77
|
+
if Log4r::NDC.get_depth > 0 && @ndc_prefix
|
74
78
|
Log4r::NDC.clone_stack.each_with_index do |x, i|
|
75
79
|
begin
|
76
|
-
opts["
|
80
|
+
opts["_#{@ndc_prefix}#{i}"] = format_attribute(x)
|
77
81
|
rescue
|
78
82
|
end
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
82
86
|
mdc = Log4r::MDC.get_context
|
83
|
-
if mdc && mdc.size > 0
|
87
|
+
if mdc && mdc.size > 0 && @mdc_prefix
|
84
88
|
mdc.each do |k, v|
|
85
89
|
begin
|
86
|
-
opts["
|
90
|
+
opts["_#{@mdc_prefix}#{k}"] = format_attribute(v)
|
87
91
|
rescue
|
88
92
|
end
|
89
93
|
end
|
data/lib/log4r-gelf/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: log4r
|