lumberjack 1.0.3 → 1.0.4

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -15,14 +15,18 @@ module Lumberjack
15
15
 
16
16
  class << self
17
17
  # Define a unit of work within a block. Within the block supplied to this
18
- # method, calling +unit_of_work_id+ will return the same 12 digit hexadecimal number string.
18
+ # method, calling +unit_of_work_id+ will return the same value that can
19
19
  # This can then be used for tying together log entries.
20
20
  #
21
+ # You can specify the id for the unit of work if desired. If you don't supply
22
+ # it, a 12 digit hexidecimal number will be automatically generated for you.
23
+ #
21
24
  # For the common use case of treating a single web request as a unit of work, see the
22
25
  # Lumberjack::Rack::UnitOfWork class.
23
- def unit_of_work
26
+ def unit_of_work(id = nil)
24
27
  save_val = Thread.current[:lumberjack_logger_unit_of_work_id]
25
- Thread.current[:lumberjack_logger_unit_of_work_id] = rand(0xFFFFFFFFFFFF).to_s(16).rjust(12, '0').upcase
28
+ id ||= rand(0xFFFFFFFFFFFF).to_s(16).rjust(12, '0').upcase
29
+ Thread.current[:lumberjack_logger_unit_of_work_id] = id
26
30
  begin
27
31
  return yield
28
32
  ensure
@@ -17,6 +17,13 @@ describe Lumberjack do
17
17
  end
18
18
  Lumberjack.unit_of_work_id.should == nil
19
19
  end
20
+
21
+ it "should allow you to specify a unit of work id for a block" do
22
+ Lumberjack.unit_of_work("foo") do
23
+ Lumberjack.unit_of_work_id.should == "foo"
24
+ end
25
+ Lumberjack.unit_of_work_id.should == nil
26
+ end
20
27
  end
21
28
 
22
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumberjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
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: 2013-03-19 00:00:00.000000000 Z
12
+ date: 2013-06-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A simple, powerful, and very fast logging utility that can be a drop
15
15
  in replacement for Logger or ActiveSupport::BufferedLogger. Provides support for