lumberjack 1.2.3 → 1.2.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
  SHA256:
3
- metadata.gz: 55a35b3e0ea957e0a08049bd7a6b7b6e7373d79983e96a6459f1448b1d3d3dbe
4
- data.tar.gz: 4cd9386b842c1686af145ef3f369219d78846aa4f5fd1223b3234b4ae91f63ef
3
+ metadata.gz: 477e85433c8d726c881946ab35ad3d3fc1cffc20ceeec9efc41a74f7bf91ef8d
4
+ data.tar.gz: 325441e14a7f92374002069190cc3c9324e5ccae48a550aae705f177e877d62b
5
5
  SHA512:
6
- metadata.gz: 81108d71edd9c6ebd0653d5d8e13587bf0a88796f5682d2b9c602c8977c2ade0f343b9fc3086658c3764cd8d8dd3b8f8ccc8b5cf5bf460225f1719a1116e8742
7
- data.tar.gz: b7c8f80a651358bb763811d9068c113b72a6948a9e513394a4f456192076e0b654ea101c1c0ce723d14f94f9b574b749ce5f9f9580b3051a8f2cd84d8c1c7a7a
6
+ metadata.gz: 2161522abc951fd9db62a6594bb5dbea0eb392aac7f42960818dbfe673f34822fcd6d3af3037a5ba6029f837ec54880c992b959a503a133c9be30ff81ae75c94
7
+ data.tar.gz: cb0bea0a04c752eb2597ec57befc6391955adfb39f26201041ce7023c458e69b83a36ccdd1bdaeaa7bb04f41686441c6e083461fa40775b563570300507032f4
@@ -1,3 +1,7 @@
1
+ ## 1.2.4
2
+
3
+ * Enhance ActiveSupport::TaggedLogging support so code that Lumberjack loggers can be wrapped with a tagged logger.
4
+
1
5
  ## 1.2.3
2
6
 
3
7
  * Fix structured formatter so no-recursive, duplicate references are allowed.
data/README.md CHANGED
@@ -85,13 +85,13 @@ logger.info("no requests") # Will not include the `request_id` tag
85
85
 
86
86
  Tag keys are always converted to strings. Tags are inherited so that message tags take precedence over block tags which take precedence over global tags.
87
87
 
88
- #### Compatibility with ActiveSupport::TaggedLogger
88
+ #### Compatibility with ActiveSupport::TaggedLogging
89
89
 
90
- `Lumberjack::Logger` version 1.1.2 or greater is compatible with `ActiveSupport::TaggedLogger`. This is so that other code that expect to have a logger that responds to the `tagged` method will work. Any tags added with the `tagged` method will be appended to an array in the the "tagged" tag. However, if a tagged value has a colon or equals sign in it, it will be parsed to a name value pair.
90
+ `Lumberjack::Logger` version 1.1.2 or greater is compatible with `ActiveSupport::TaggedLogging`. This is so that other code that expect to have a logger that responds to the `tagged` method will work. Any tags added with the `tagged` method will be appended to an array in the the "tagged" tag.
91
91
 
92
92
  ```ruby
93
- logger.tagged("foo", "bar=1", "baz:2", "other") do
94
- logger.info("here") # will include tags: {"tagged" => ["foo", "other"], "bar" => "1", "baz" => "2"}
93
+ logger.tagged("foo", "bar=1", "other") do
94
+ logger.info("here") # will include tags: {"tagged" => ["foo", "bar=1", "other"]}
95
95
  end
96
96
  ```
97
97
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.2.4
@@ -19,6 +19,7 @@ module Lumberjack
19
19
  require_relative "lumberjack/tags.rb"
20
20
  require_relative "lumberjack/tag_formatter.rb"
21
21
  require_relative "lumberjack/tagged_logger_support.rb"
22
+ require_relative "lumberjack/tagged_logging.rb"
22
23
  require_relative "lumberjack/template.rb"
23
24
  require_relative "lumberjack/rack.rb"
24
25
 
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lumberjack
4
+ # Monkey patch for ActiveSupport::TaggedLogger so it doesn't blow up when
5
+ # a Lumberjack logger is trying to be wrapped. This module will be automatically
6
+ # included in ActiveSupport::TaggedLogger if activesupport is already loaded.
7
+ module TaggedLogging
8
+ class << self
9
+ def included(base)
10
+ base.singleton_class.send(:prepend, ClassMethods)
11
+ end
12
+ end
13
+
14
+ module ClassMethods
15
+ def new(logger)
16
+ if logger.is_a?(Lumberjack::Logger)
17
+ logger = logger.tagged_logger! unless logger.respond_to?(:tagged)
18
+ logger
19
+ else
20
+ super
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ if defined?(ActiveSupport::TaggedLogging)
28
+ ActiveSupport::TaggedLogging.include(Lumberjack::TaggedLogging)
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumberjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-05 00:00:00.000000000 Z
11
+ date: 2020-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -106,6 +106,7 @@ files:
106
106
  - lib/lumberjack/severity.rb
107
107
  - lib/lumberjack/tag_formatter.rb
108
108
  - lib/lumberjack/tagged_logger_support.rb
109
+ - lib/lumberjack/tagged_logging.rb
109
110
  - lib/lumberjack/tags.rb
110
111
  - lib/lumberjack/template.rb
111
112
  - lumberjack.gemspec