tagged_logging 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/tagged_logging/formatter.rb +1 -1
- data/lib/tagged_logging/version.rb +1 -1
- data/test/logger_test.rb +14 -14
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/test/logger_test.rb
CHANGED
@@ -12,17 +12,17 @@ class LoggerTest < Test::Unit::TestCase
|
|
12
12
|
|
13
13
|
test "tagged once" do
|
14
14
|
@logger.tagged("BCX") { @logger.info "Funky time" }
|
15
|
-
assert_match "INFO
|
15
|
+
assert_match "INFO - [BCX] - Funky time\n", @output.string
|
16
16
|
end
|
17
17
|
|
18
18
|
test "tagged twice" do
|
19
19
|
@logger.tagged("BCX") { @logger.tagged("Jason") { @logger.info "Funky time" } }
|
20
|
-
assert_match "INFO
|
20
|
+
assert_match "INFO - [BCX] [Jason] - Funky time\n", @output.string
|
21
21
|
end
|
22
22
|
|
23
23
|
test "tagged thrice at once" do
|
24
24
|
@logger.tagged("BCX", "Jason", "New") { @logger.info "Funky time" }
|
25
|
-
assert_match "INFO
|
25
|
+
assert_match "INFO - [BCX] [Jason] [New] - Funky time", @output.string
|
26
26
|
end
|
27
27
|
|
28
28
|
test "tagged are flattened" do
|
@@ -45,20 +45,20 @@ class LoggerTest < Test::Unit::TestCase
|
|
45
45
|
assert_equal [], @logger.clear_tags!
|
46
46
|
@logger.info 'd'
|
47
47
|
|
48
|
-
assert_match "INFO
|
49
|
-
assert_match "INFO
|
50
|
-
assert_match "INFO
|
51
|
-
assert_match "INFO
|
48
|
+
assert_match "INFO - [A] [B] [C] - a", @output.string
|
49
|
+
assert_match "INFO - [A] [B] - b", @output.string
|
50
|
+
assert_match "INFO - [A] - c", @output.string
|
51
|
+
assert_match "INFO - - d", @output.string
|
52
52
|
end
|
53
53
|
|
54
54
|
test "does not strip message content" do
|
55
55
|
@logger.info " \t\t Hello"
|
56
|
-
assert_match "INFO
|
56
|
+
assert_match "INFO - - \t\t Hello\n", @output.string
|
57
57
|
end
|
58
58
|
|
59
59
|
test "tagged once with blank and nil" do
|
60
60
|
@logger.tagged(nil, "", "New") { @logger.info "Funky time" }
|
61
|
-
assert_match "INFO
|
61
|
+
assert_match "INFO - [New] - Funky time", @output.string
|
62
62
|
end
|
63
63
|
|
64
64
|
test "keeps each tag in their own thread" do
|
@@ -68,8 +68,8 @@ class LoggerTest < Test::Unit::TestCase
|
|
68
68
|
end.join
|
69
69
|
@logger.info "Funky time"
|
70
70
|
end
|
71
|
-
assert_match "INFO
|
72
|
-
assert_match "INFO
|
71
|
+
assert_match "INFO - [OMG] - Cool story bro", @output.string
|
72
|
+
assert_match "INFO - [BCX] - Funky time\n", @output.string
|
73
73
|
end
|
74
74
|
|
75
75
|
test "cleans up the taggings on flush" do
|
@@ -81,7 +81,7 @@ class LoggerTest < Test::Unit::TestCase
|
|
81
81
|
end
|
82
82
|
end.join
|
83
83
|
end
|
84
|
-
assert_match "INFO
|
84
|
+
assert_match "INFO - - Cool story bro", @output.string
|
85
85
|
end
|
86
86
|
|
87
87
|
test "mixed levels of tagging" do
|
@@ -90,8 +90,8 @@ class LoggerTest < Test::Unit::TestCase
|
|
90
90
|
@logger.info "Junky time!"
|
91
91
|
end
|
92
92
|
|
93
|
-
assert_match "INFO
|
94
|
-
assert_match "INFO
|
93
|
+
assert_match "INFO - [BCX] [Jason] - Funky time", @output.string
|
94
|
+
assert_match "INFO - [BCX] - Junky time!", @output.string
|
95
95
|
end
|
96
96
|
|
97
97
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagged_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
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: 2012-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|