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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tagged_logging (0.1.1)
4
+ tagged_logging (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -4,7 +4,7 @@ require 'tagged_logging/blank_ext'
4
4
  module TaggedLogging
5
5
  class Formatter < ::Logger::Formatter
6
6
 
7
- FORMAT = "[%s] - %4s - %s - %s\n"
7
+ FORMAT = "[%s] - %-5s - %s - %s\n"
8
8
 
9
9
  def call(severity, time, progname, msg)
10
10
  str = case msg
@@ -2,7 +2,7 @@ module TaggedLogging
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 1
5
+ PATCH = 2
6
6
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
8
8
  end
@@ -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 - [BCX] - Funky time\n", @output.string
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 - [BCX] [Jason] - Funky time\n", @output.string
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 - [BCX] [Jason] [New] - Funky time", @output.string
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 - [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
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 - - \t\t Hello\n", @output.string
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 - [New] - Funky time", @output.string
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 - [OMG] - Cool story bro", @output.string
72
- assert_match "INFO - [BCX] - Funky time\n", @output.string
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 - - Cool story bro", @output.string
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 - [BCX] [Jason] - Funky time", @output.string
94
- assert_match "INFO - [BCX] - Junky time!", @output.string
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.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-15 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit