sonnet 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sonnet/rails.rb +13 -1
- data/lib/sonnet/version.rb +1 -1
- data/test/{logger_test.rb → sonnet/logger_test.rb} +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c4641035ac6ac2af9894fde837738f9a3b0b1fc8f1d625c8f6ed3ffbb7a8f45
|
4
|
+
data.tar.gz: 03651c0c7a9162c27f92783ab482147d263e88d0fe972b1ab7a7c65a9b4a51be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f95461bbe2e78cbb571822c92ab8eb246bfc9c2920c501ab2cf2333489e5f1b3e1d5dd9c40c933c36091926107be37d3f83a548ec449ba9ccf65b3956620f4
|
7
|
+
data.tar.gz: 554d1034d5a275fdaec1379ad1ae8f32309a467f2cc1a239086397fe9ba5171d0ec082e51f11ed8af893ceadd06842a793bf0e78edec1c13b911c7181cc53e93
|
data/Gemfile.lock
CHANGED
data/lib/sonnet/rails.rb
CHANGED
@@ -24,14 +24,26 @@ module Sonnet
|
|
24
24
|
|
25
25
|
def tagged(*tags, &block)
|
26
26
|
if tags.present?
|
27
|
-
with_context(tags: tags, &block)
|
27
|
+
with_context(tags: tags.flatten, &block)
|
28
28
|
else
|
29
29
|
yield self
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
module RailsFormatter
|
35
|
+
def current_tags
|
36
|
+
current_context.inject([]) do |memo, context|
|
37
|
+
memo + [*context[:tags]].flatten.compact
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
34
42
|
module Logger
|
35
43
|
include RailsLogger
|
36
44
|
end
|
45
|
+
|
46
|
+
class Formatter
|
47
|
+
extend RailsFormatter
|
48
|
+
end
|
37
49
|
end
|
data/lib/sonnet/version.rb
CHANGED
@@ -33,4 +33,11 @@ class LoggerTest < Minitest::Test
|
|
33
33
|
assert_equal log[0].slice(:color, :message), color: "blue", message: "What's the story, morning glory?"
|
34
34
|
assert_equal log[1].slice(:color, :message), message: "definitely maybe"
|
35
35
|
end
|
36
|
+
|
37
|
+
def test_new
|
38
|
+
logger = Sonnet::Logger.new(Logger.new(io))
|
39
|
+
assert_equal logger.formatter, Sonnet::Formatter
|
40
|
+
logger.info("What's the story, morning glory?")
|
41
|
+
assert_log_line log[0], level: "info", message: "What's the story, morning glory?"
|
42
|
+
end
|
36
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonnet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cory Kaufman-Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -103,9 +103,9 @@ files:
|
|
103
103
|
- lib/sonnet/rails_monkeypatch.rb
|
104
104
|
- lib/sonnet/version.rb
|
105
105
|
- sonnet.gemspec
|
106
|
-
- test/logger_test.rb
|
107
106
|
- test/rails_logger_test.rb
|
108
107
|
- test/sonnet/formatter_test.rb
|
108
|
+
- test/sonnet/logger_test.rb
|
109
109
|
- test/test_helper.rb
|
110
110
|
homepage: https://github.com/allspiritseve/sonnet
|
111
111
|
licenses:
|