log_weasel 0.0.6 → 0.0.7

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- log_weasel (0.0.6)
4
+ log_weasel (0.0.7)
5
5
  activesupport (~> 3.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -20,34 +20,17 @@ Use bundler to install it:
20
20
  bundle install
21
21
  </pre>
22
22
 
23
- ## Configure
23
+ ## Rails 3
24
24
 
25
- In your application initialization (e.g. config/initializers/log_weasel.rb) load and configure Log Weasel with:
25
+ For Rails 3, we provide a Railtie that automatically configures and loads Log Weasel.
26
26
 
27
- <pre>
28
- LogWeasel.configure do |config|
29
- config.key = "YOUR_APP"
30
- end
31
- <pre>
32
-
33
- <code>key</code> is a string that will be included in your transaction IDs and is particularly
34
- useful in an environment where a unit of work may span multiple applications.
35
-
36
- ## Rack
37
-
38
- Log Weasel provides Rack middleware to create and destroy a transaction ID for every HTTP request. You can use it
39
- in a any web framework that supports Rack (Rails, Sinatra,...) by using <code>LogWeasel::Middleware</code> in your middleware
40
- stack.
41
-
42
- ### Rails 3
43
-
44
- For Rails 3, we provide a Railtie that automatically registers the Rack middleware.
45
-
46
- All you need to see Log Weasel transaction IDs in your Rails logs is to either use the BufferedLogger provided or
27
+ To see Log Weasel transaction IDs in your Rails logs either use the BufferedLogger provided or
47
28
  customize the formatting of your logger to include <code>LogWeasel::Transaction.id</code>.
48
29
 
49
30
  <pre>
50
31
  YourApp::Application.configure do
32
+ config.log_weasel.key = 'YOUR_APP' # Optional. Defaults to Rails application name.
33
+
51
34
  logger = LogWeasel::BufferedLogger.new "#{Rails.root}/log/#{Rails.env}.log"
52
35
  config.logger = logger
53
36
  config.action_controller.logger = logger
@@ -55,9 +38,33 @@ YourApp::Application.configure do
55
38
  end
56
39
  </pre>
57
40
 
41
+
42
+ ## Other
43
+
44
+ ### Configure
45
+
46
+ Load and configure Log Weasel with:
47
+
48
+ <pre>
49
+ LogWeasel.configure do |config|
50
+ config.key = "YOUR_APP"
51
+ end
52
+ </pre>
53
+
54
+ <code>config.key</code> is a string that will be included in your transaction IDs and is particularly
55
+ useful in an environment where a unit of work may span multiple applications. It is optional but you must call
56
+ <code>LogWeasel.configure</code>.
57
+
58
+ ### Rack
59
+
60
+ Log Weasel provides Rack middleware to create and destroy a transaction ID for every HTTP request. You can use it
61
+ in a any web framework that supports Rack (Rails, Sinatra,...) by using <code>LogWeasel::Middleware</code> in your middleware
62
+ stack.
63
+
58
64
  ## Resque
59
65
 
60
- When you configure Log Weasel as described above, it modifies Resque to include transaction IDs in all worker logs.
66
+ When you configure Log Weasel as described above either in Rails or by explicitly calling <code>LogWeasel.configure</code>,
67
+ it modifies Resque to include transaction IDs in all worker logs.
61
68
 
62
69
  Start your Resque worker with <code>VERBOSE=1</code> and you'll see transaction IDs in your Resque logs.
63
70
 
@@ -1,5 +1,19 @@
1
1
  require 'rails'
2
2
 
3
3
  class LogWeasel::Railtie < Rails::Railtie
4
- config.app_middleware.insert_before "::Rails::Rack::Logger", "LogWeasel::Middleware"
4
+ config.log_weasel = ActiveSupport::OrderedOptions.new # enable namespaced configuration in Rails environments
5
+
6
+ initializer "log_weasel.configure" do |app|
7
+ LogWeasel.configure do |config|
8
+ config.key = app.config.log_weasel[:key] || self.app_name
9
+ end
10
+
11
+ app.config.middleware.insert_before "::Rails::Rack::Logger", "LogWeasel::Middleware"
12
+ end
13
+
14
+ private
15
+
16
+ def self.app_name
17
+ ::Rails.application.class.to_s.split("::").first
18
+ end
5
19
  end
@@ -1,5 +1,5 @@
1
1
  module Log
2
2
  module Weasel
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: log_weasel
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alon Salant
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- hash: 2735436436315165741
117
+ hash: -4485135031128560136
118
118
  segments:
119
119
  - 0
120
120
  version: "0"
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- hash: 2735436436315165741
126
+ hash: -4485135031128560136
127
127
  segments:
128
128
  - 0
129
129
  version: "0"
@@ -133,7 +133,7 @@ rubyforge_project: log_weasel
133
133
  rubygems_version: 1.5.2
134
134
  signing_key:
135
135
  specification_version: 3
136
- summary: log_weasel-0.0.6
136
+ summary: log_weasel-0.0.7
137
137
  test_files:
138
138
  - spec/log_weasel/buffered_logger_spec.rb
139
139
  - spec/log_weasel/hoptoad_notifier_spec.rb