dlogger 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: af1bd8fdd7d791b39c4fe3d106a8df1db5ab0f74
4
+ data.tar.gz: 94c6a2f737b107d8885a5c3e0a691fbf54e86b7a
5
+ SHA512:
6
+ metadata.gz: 856eb08a81421676af540cc839491c60b2b10cbdccc977c38ff36ff056d3ead02f70fbecdb71a3a1761e60623a0eefaeb457035e9a6a5f00c3d2978ae7672918
7
+ data.tar.gz: 56dca1e86e6a402c54226c49be0a64fea832e260f0474bd32efef966ab901c4fae1860150a2b3f29ba3d11a50d7bd076e00f78d2a098eef7ca58676a82ecbe6f
data/ChangeLog CHANGED
@@ -1,4 +1,8 @@
1
1
 
2
+ = 0.0.4
3
+
4
+ - Allow proc to be used as contetx value
5
+
2
6
  = 0.0.3
3
7
 
4
8
  - Added SplunkStorm output
data/README.md CHANGED
@@ -131,7 +131,7 @@ logger.log("but not here")
131
131
  ## Threads and Fibers friendly
132
132
 
133
133
  Whether you use threads or fibers for concurrency you are good to go, the contexts are
134
- store with Thread.current which is local to the current fiber (thread's root fiber if not using
134
+ stored with Thread.current[] which is local to the current fiber (thread's root fiber if not using
135
135
  Fiber explicitly).
136
136
 
137
137
  ``` ruby
@@ -56,7 +56,7 @@ example if use the thread local variables to store the user, session or anything
56
56
  ## Threads and Fibers friendly
57
57
 
58
58
  Whether you use threads or fibers for concurrency you are good to go, the contexts are
59
- store with Thread.current which is local to the current fiber (thread's root fiber if not using
59
+ stored with Thread.current[] which is local to the current fiber (thread's root fiber if not using
60
60
  Fiber explicitly).
61
61
 
62
62
  ``` ruby
@@ -40,6 +40,12 @@ module DLogger
40
40
  merged_metadata.merge!(metadata)
41
41
 
42
42
  # and dispatch the result
43
+ merged_metadata.each do |k,v|
44
+ if v.is_a?(Proc)
45
+ merged_metadata[k] = v.call()
46
+ end
47
+ end
48
+
43
49
  dispatch(msg, merged_metadata)
44
50
  end
45
51
 
@@ -1,3 +1,3 @@
1
1
  module Dlogger
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -38,6 +38,15 @@ describe "Logger" do
38
38
  end
39
39
  end
40
40
 
41
+ should 'allow proc as value' do
42
+ @logger.expects(:dispatch).with('msg', :id => 43, :user => 'john')
43
+
44
+ @logger.with_context(:user => ->{ "john" } ) do
45
+ @logger.log('msg', :id => 43)
46
+ end
47
+
48
+ end
49
+
41
50
  end
42
51
 
43
52
  describe 'with extension context' do
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dlogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Julien Ammous
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-25 00:00:00.000000000 Z
11
+ date: 2013-04-23 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Advanced logger allowing you to include metadata with your messages
15
14
  email:
@@ -52,32 +51,25 @@ files:
52
51
  - specs/lib/outputs/stdout_spec.rb
53
52
  homepage: ''
54
53
  licenses: []
54
+ metadata: {}
55
55
  post_install_message:
56
56
  rdoc_options: []
57
57
  require_paths:
58
58
  - lib
59
59
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
60
  requirements:
62
- - - ! '>='
61
+ - - '>='
63
62
  - !ruby/object:Gem::Version
64
63
  version: '0'
65
- segments:
66
- - 0
67
- hash: -981071182900887075
68
64
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
65
  requirements:
71
- - - ! '>='
66
+ - - '>='
72
67
  - !ruby/object:Gem::Version
73
68
  version: '0'
74
- segments:
75
- - 0
76
- hash: -981071182900887075
77
69
  requirements: []
78
70
  rubyforge_project:
79
- rubygems_version: 1.8.24
71
+ rubygems_version: 2.0.3
80
72
  signing_key:
81
- specification_version: 3
82
- summary: ! 'Dynamic logger: add a context to your log messages'
73
+ specification_version: 4
74
+ summary: 'Dynamic logger: add a context to your log messages'
83
75
  test_files: []