bbc-cosmos-logger 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9eec35926fc0a0d39a1ca8b713fcc99654877a55
4
- data.tar.gz: ff1350aaa51d9655a49d13b3b949fb7151d3884f
3
+ metadata.gz: 5a99505f1ae8b48958cfa474a6be80215b8196b8
4
+ data.tar.gz: 70d82a53bc50c804da257631eb698477bc9fd0aa
5
5
  SHA512:
6
- metadata.gz: 4b302a130bf343ed3a6a59eeb65a2453e77b10bdf5f40a616d998a381e3903b7cec7922b1cac395945c97397c1523fb70dba40b6f69a60f1fad659f7a3dfa939
7
- data.tar.gz: adabf083314d284c3ea8900ac3f6ca35eae1a470cc450c0791def30171e740abab151efa69849f7c1bbdaede623a8627b2ff183ee42e3447cbe97db06f1598fb
6
+ metadata.gz: 0e864c30aae59b1de2458ccbec3f19324041912cfe162d4a73811f49afa9c2559361a19a88cdac9f121e04a754771560d900303da3802d3315a5a772157d38dc
7
+ data.tar.gz: 94343ee9d911fabfd37e394373ed94205dca4b1c0b3fe9705bc814307c1abe0e4f6c735d8375429d5ade7a8db2c9f66653e9ebdffd171abcb7db3952cfacb30c
@@ -1,7 +1,7 @@
1
1
  module BBC
2
2
  module Cosmos
3
3
  module Logger
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -26,9 +26,27 @@ module BBC
26
26
  DEFAULT_GELF_SERVER = 'localhost'
27
27
  DEFAULT_GELF_PORT = '12201'
28
28
 
29
+ def self.level
30
+ case "#{ENV['APP_LOG_LEVEL']}".upcase
31
+ when 'DEBUG'
32
+ Log4r::DEBUG
33
+ when 'INFO'
34
+ Log4r::INFO
35
+ when 'WARN'
36
+ Log4r::WARN
37
+ when 'ERROR'
38
+ Log4r::ERROR
39
+ when 'FATAL'
40
+ Log4r::FATAL
41
+ else
42
+ Log4r::INFO
43
+ end
44
+ end
45
+
29
46
  def self.create(id)
30
47
  log = Log4r::Logger.new(id)
31
48
 
49
+ # Add File Outputter
32
50
  Log4r::RollingFileOutputter.new(
33
51
  'logfile',
34
52
  :formatter => SimpleFormatter,
@@ -36,14 +54,20 @@ module BBC
36
54
  :max_backups => ENV['LOG_MAX_BACKUPS'] || DEFAULT_MAX_BACKUPS,
37
55
  :maxtime => ENV['LOG_MAXTIME'] || DEFAULT_MAXTIME,
38
56
  :trunc => true)
57
+ log.add('logfile')
39
58
 
59
+ # Add Gelf Outputter
40
60
  Log4r::GelfOutputter.new(
41
61
  'gelfling',
42
62
  :formatter => SimpleFormatter,
43
63
  'gelf_server' => ENV['GELF_SERVER'],
44
64
  'gelf_port' => ENV['GELF_PORT'])
65
+ log.add('gelfling')
66
+
67
+ # Set Log Level
68
+ log.level = level
45
69
 
46
- log.tap {|l| l.add('logfile', 'gelfling') }
70
+ log
47
71
  end
48
72
  end
49
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbc-cosmos-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Kenny
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-23 00:00:00.000000000 Z
12
+ date: 2014-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: log4r
@@ -108,4 +108,3 @@ signing_key:
108
108
  specification_version: 4
109
109
  summary: Ruby logging on Cosmos
110
110
  test_files: []
111
- has_rdoc: