lumberyak 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2542d62276a1c1c56ee45a5108a106063cabec72
4
- data.tar.gz: 82a9624e5dfbc30b194c0f3629a4d3cec8f1a833
3
+ metadata.gz: 87234397acb71a16222b6b95aab20fb1588b8262
4
+ data.tar.gz: b99d74f5d40fd39be5aa2f912a938dca5af8fc3b
5
5
  SHA512:
6
- metadata.gz: 5eb223c4d0ef4317ef1277d50b8ef3efeb500d0c803c6421e1b689eb1551508e6371811c6fdf1a7adb40801e83439e23895a57aa350ed87231c9f36c9cb03b61
7
- data.tar.gz: f66379861291b2ca798ba869442dbe8dde0bf469f77f258243533a503e778a6be1d3bf2dbdc3146ec14e8ec6ebe9e62ad6ad424b86cec2a89018a690a4021a66
6
+ metadata.gz: 0df163158bb3e33610a1bfe67aa3d9539c3e81d973ccab58ec0e78d60fae67a421aca47c158d3dc20f0b6426d328323066cdb8b69e8b858813d7f012285a3cc6
7
+ data.tar.gz: 070e59c2872f816cb36145921e65fbf3deecf416527b43ade9d8a8d21be5183723f2416ab46842e497235c52dab378764e09ce35e8d3c802ba6093c9fde21f8b
@@ -0,0 +1,25 @@
1
+
2
+ # Monkey patch the rails dispatcher just before it hands over control to our
3
+ # controller implementation. In doing so, we can included the name of the
4
+ # controller and action to be executed in all calls to Rails.logger in the
5
+ # context of any of our application controllers.
6
+ # Note the use of `prepend` to deal with the fact that the `dispatch()` function
7
+ # is class private.
8
+
9
+ module DispatcherExtensions
10
+ def dispatch(controller, action, env)
11
+ Rails.logger.tagged({ controller: controller.to_s, action: action.to_s }) do
12
+ super
13
+ end
14
+ end
15
+ end
16
+
17
+ module ActionDispatch
18
+ module Routing
19
+ class RouteSet
20
+ class Dispatcher
21
+ prepend DispatcherExtensions
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module LumberYak
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.1.1".freeze
4
4
  end
data/lib/lumberyak.rb CHANGED
@@ -1,4 +1,5 @@
1
1
 
2
+ require 'action_dispatch'
2
3
  require 'active_support'
3
4
  require 'rails/railtie'
4
5
  require 'lograge'
@@ -49,6 +50,9 @@ module LumberYak
49
50
 
50
51
  def setup_logtags
51
52
  application.config.log_tags = config.log_tags if config.log_tags
53
+
54
+ # require our dispatcher monkey patch to enable controller/action tags
55
+ require 'action_dispatch/routing/route_set/dispatcher.rb'
52
56
  end
53
57
 
54
58
  def enable_json_logging
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumberyak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Roddy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-14 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -119,6 +119,7 @@ executables: []
119
119
  extensions: []
120
120
  extra_rdoc_files: []
121
121
  files:
122
+ - lib/action_dispatch/routing/route_set/dispatcher.rb
122
123
  - lib/activesupport/taggedlogging/formatter.rb
123
124
  - lib/lograge/formatter/noformat.rb
124
125
  - lib/lumberyak.rb
@@ -143,8 +144,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
144
  version: '0'
144
145
  requirements: []
145
146
  rubyforge_project:
146
- rubygems_version: 2.4.5.1
147
+ rubygems_version: 2.6.3
147
148
  signing_key:
148
149
  specification_version: 4
149
150
  summary: Structured Logging for Rails Applications
150
151
  test_files: []
152
+ has_rdoc: