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.
@@ -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::ERROR,
13
- "ERROR" => GELF::Levels::FATAL,
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[:gelf_server] || "127.0.0.1"
21
- port = hash[:gelf_port] || 12201
22
- max_chunk_size = hash[:max_chunk_size] || 'LAN'
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[:host] if hash[:host]
25
- opts['facility'] = hash[:facility] if hash[:facility]
26
- opts['level'] = hash[:level] if hash[:level]
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
- end
67
+
68
68
  end
@@ -1,5 +1,5 @@
1
1
  module Log4r
2
2
  module Gelf
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
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.0')
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.6.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-02-20 00:00:00.000000000 Z
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: &70174364072700 !ruby/object:Gem::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: '1.0'
21
+ version: 1.1.10
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70174364072700
24
+ version_requirements: *70294257650700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: gelf
27
- requirement: &70174363835420 !ruby/object:Gem::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: *70174363835420
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