logging 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -6
- data/History.txt +15 -0
- data/LICENSE +22 -0
- data/README.md +20 -41
- data/examples/layouts.rb +1 -1
- data/examples/lazy.rb +1 -1
- data/examples/reusing_layouts.rb +51 -0
- data/lib/logging.rb +52 -3
- data/lib/logging/appender.rb +2 -2
- data/lib/logging/appenders/console.rb +1 -1
- data/lib/logging/appenders/rolling_file.rb +11 -1
- data/lib/logging/color_scheme.rb +1 -1
- data/lib/logging/diagnostic_context.rb +99 -74
- data/lib/logging/layout.rb +46 -1
- data/lib/logging/layouts/parseable.rb +7 -4
- data/lib/logging/layouts/pattern.rb +4 -2
- data/lib/logging/log_event.rb +18 -11
- data/lib/logging/logger.rb +2 -2
- data/lib/logging/rails_compat.rb +4 -13
- data/lib/logging/version.rb +1 -1
- data/logging.gemspec +32 -33
- data/test/layouts/test_json.rb +13 -0
- data/test/layouts/test_pattern.rb +15 -2
- data/test/layouts/test_yaml.rb +14 -0
- data/test/test_layout.rb +40 -0
- data/test/test_log_event.rb +8 -0
- data/test/test_logging.rb +28 -0
- data/test/test_mapped_diagnostic_context.rb +15 -6
- data/test/test_nested_diagnostic_context.rb +6 -1
- metadata +8 -6
data/test/test_logging.rb
CHANGED
@@ -39,6 +39,34 @@ module TestLogging
|
|
39
39
|
assert_raise(ArgumentError) {::Logging.backtrace 'foo'}
|
40
40
|
end
|
41
41
|
|
42
|
+
def test_utc_offset
|
43
|
+
assert_nil ::Logging.utc_offset
|
44
|
+
|
45
|
+
::Logging.utc_offset = 0
|
46
|
+
assert_equal 0, ::Logging.utc_offset
|
47
|
+
|
48
|
+
::Logging.utc_offset = "UTC"
|
49
|
+
assert_equal 0, ::Logging.utc_offset
|
50
|
+
|
51
|
+
::Logging.utc_offset = "+01:00"
|
52
|
+
assert_equal "+01:00", ::Logging.utc_offset
|
53
|
+
|
54
|
+
assert_raise(ArgumentError) {::Logging.utc_offset = "06:00"}
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_basepath
|
58
|
+
assert_nil ::Logging.basepath
|
59
|
+
|
60
|
+
::Logging.basepath = ""
|
61
|
+
assert_nil ::Logging.basepath
|
62
|
+
|
63
|
+
::Logging.basepath = "./"
|
64
|
+
assert_equal File.expand_path("../../", __FILE__), ::Logging.basepath
|
65
|
+
|
66
|
+
::Logging.reset
|
67
|
+
assert_nil ::Logging.basepath
|
68
|
+
end
|
69
|
+
|
42
70
|
def test_logger
|
43
71
|
assert_raise(TypeError) {::Logging.logger []}
|
44
72
|
|
@@ -105,12 +105,21 @@ module TestLogging
|
|
105
105
|
|
106
106
|
assert_not_equal context.object_id, Logging.mdc.context.object_id
|
107
107
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
if Logging::INHERIT_CONTEXT
|
109
|
+
assert_equal 1, Logging.mdc['foo']
|
110
|
+
assert_equal 'buz', Logging.mdc['baz']
|
111
|
+
assert_equal 'something else', Logging.mdc['foobar']
|
112
|
+
assert_nil Logging.mdc['unique']
|
113
|
+
|
114
|
+
assert_equal 1, Logging.mdc.stack.length
|
115
|
+
else
|
116
|
+
assert_nil Logging.mdc['foo']
|
117
|
+
assert_nil Logging.mdc['baz']
|
118
|
+
assert_nil Logging.mdc['foobar']
|
119
|
+
assert_nil Logging.mdc['unique']
|
120
|
+
|
121
|
+
assert_equal 1, Logging.mdc.stack.length
|
122
|
+
end
|
114
123
|
}
|
115
124
|
|
116
125
|
Thread.pass until t.status == 'sleep'
|
@@ -85,7 +85,12 @@ module TestLogging
|
|
85
85
|
sleep
|
86
86
|
|
87
87
|
assert_not_equal ary.object_id, Logging.ndc.context.object_id
|
88
|
-
|
88
|
+
|
89
|
+
if Logging::INHERIT_CONTEXT
|
90
|
+
assert_equal %w[first second], Logging.ndc.context
|
91
|
+
else
|
92
|
+
assert_empty Logging.ndc.context
|
93
|
+
end
|
89
94
|
}
|
90
95
|
|
91
96
|
Thread.pass until t.status == 'sleep'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Pease
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: little-plugger
|
@@ -72,16 +72,16 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.8.
|
75
|
+
version: 3.8.4
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.8.
|
82
|
+
version: 3.8.4
|
83
83
|
description: |-
|
84
|
-
Logging is a flexible logging library for use in Ruby programs based on the
|
84
|
+
**Logging** is a flexible logging library for use in Ruby programs based on the
|
85
85
|
design of Java's log4j library. It features a hierarchical logging system,
|
86
86
|
custom level names, multiple output destinations per log event, custom
|
87
87
|
formatting, and more.
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- ".gitignore"
|
95
95
|
- ".travis.yml"
|
96
96
|
- History.txt
|
97
|
+
- LICENSE
|
97
98
|
- README.md
|
98
99
|
- Rakefile
|
99
100
|
- examples/appenders.rb
|
@@ -109,6 +110,7 @@ files:
|
|
109
110
|
- examples/mdc.rb
|
110
111
|
- examples/names.rb
|
111
112
|
- examples/rails4.rb
|
113
|
+
- examples/reusing_layouts.rb
|
112
114
|
- examples/rspec_integration.rb
|
113
115
|
- examples/simple.rb
|
114
116
|
- lib/logging.rb
|
@@ -194,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
196
|
version: '0'
|
195
197
|
requirements: []
|
196
198
|
rubyforge_project: logging
|
197
|
-
rubygems_version: 2.
|
199
|
+
rubygems_version: 2.6.8
|
198
200
|
signing_key:
|
199
201
|
specification_version: 4
|
200
202
|
summary: A flexible and extendable logging library for Ruby
|