log4r-gelf 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/log4r-gelf/gelf_outputter.rb +11 -11
- data/lib/log4r-gelf/version.rb +1 -1
- data/log4r-gelf.gemspec +4 -1
- metadata +29 -7
@@ -2,36 +2,36 @@ require 'gelf'
|
|
2
2
|
require 'log4r/outputter/outputter'
|
3
3
|
|
4
4
|
module Log4r
|
5
|
-
module Gelf
|
6
5
|
|
7
6
|
class GelfOutputter < Log4r::Outputter
|
8
7
|
|
9
8
|
LEVELS_MAP = {
|
10
9
|
"DEBUG" => GELF::Levels::DEBUG,
|
11
10
|
"INFO" => GELF::Levels::INFO,
|
12
|
-
"WARN" => GELF::Levels::
|
13
|
-
"ERROR" => GELF::Levels::
|
11
|
+
"WARN" => GELF::Levels::WARN,
|
12
|
+
"ERROR" => GELF::Levels::ERROR,
|
14
13
|
"FATAL" => GELF::Levels::FATAL,
|
15
14
|
}
|
16
15
|
|
17
16
|
def initialize(_name, hash={})
|
18
17
|
super(_name, hash)
|
19
18
|
|
20
|
-
server = hash[
|
21
|
-
port = hash[
|
22
|
-
max_chunk_size = hash[
|
19
|
+
server = hash['gelf_server'] || "127.0.0.1"
|
20
|
+
port = (hash['gelf_port'] || 12201).to_i
|
21
|
+
max_chunk_size = hash['max_chunk_size'] || 'LAN'
|
23
22
|
opts = {}
|
24
|
-
opts['host'] = hash[
|
25
|
-
opts['facility'] = hash[
|
26
|
-
opts['level'] = hash[
|
23
|
+
opts['host'] = hash['host'] if hash['host']
|
24
|
+
opts['facility'] = hash['facility'] if hash['facility']
|
25
|
+
opts['level'] = LEVELS_MAP[hash['level']] if hash['level']
|
27
26
|
|
28
27
|
@notifier = GELF::Notifier.new(server, port, max_chunk_size, opts)
|
29
28
|
end
|
30
29
|
|
31
30
|
private
|
32
|
-
|
31
|
+
|
33
32
|
def canonical_log(logevent)
|
34
33
|
level = LEVELS_MAP[Log4r::LNAMES[logevent.level]]
|
34
|
+
level = GELF::Levels::DEBUG unless level
|
35
35
|
|
36
36
|
msg = "#{logevent.fullname}: #{logevent.data.to_s}"
|
37
37
|
|
@@ -64,5 +64,5 @@ module Log4r
|
|
64
64
|
end
|
65
65
|
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
end
|
data/lib/log4r-gelf/version.rb
CHANGED
data/log4r-gelf.gemspec
CHANGED
@@ -26,7 +26,10 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.executables = []
|
27
27
|
s.require_paths = ["lib"]
|
28
28
|
|
29
|
-
s.add_dependency("log4r", '~> 1.
|
29
|
+
s.add_dependency("log4r", '~> 1.1.10')
|
30
30
|
s.add_dependency("gelf", '~> 1.3')
|
31
|
+
|
32
|
+
s.add_development_dependency('rake')
|
33
|
+
s.add_development_dependency('rspec')
|
31
34
|
|
32
35
|
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.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: log4r
|
16
|
-
requirement: &
|
16
|
+
requirement: &70294257650700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.1.10
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70294257650700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: gelf
|
27
|
-
requirement: &
|
27
|
+
requirement: &70294257649120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,29 @@ dependencies:
|
|
32
32
|
version: '1.3'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70294257649120
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &70294257664320 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70294257664320
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &70294257661240 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70294257661240
|
36
58
|
description: A Log4r appender for logging to a gelf sink, e.g. the graylog2 server
|
37
59
|
email:
|
38
60
|
- matt@conwaysplace.com
|