logsly 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logsly.rb +1 -1
- data/lib/logsly/version.rb +1 -1
- data/test/unit/logsly_tests.rb +49 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e161d2c0d18dc40b810f38f9591460cc8435ebb6
|
4
|
+
data.tar.gz: 5458e34127fb730f9739d44dc9e25aa93c6d30f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05b04ce8e852655f3905046e167731298a56d0e97f09922c2d6b2dc426a97a1837c07ab1b80d4d0a9c9cf750b5ff18e499430e856cc331d53799df33d4f21a94
|
7
|
+
data.tar.gz: 16f8af3abc0d39c5dce1597999cd226e02326bb4aaf61d5948e04e86dd24639e78e4057d386223b1858cb9cdd556c1e5d43e9b2bbf7f1fbe3e80cb3a6a50fdf8
|
data/lib/logsly.rb
CHANGED
@@ -63,7 +63,7 @@ module Logsly
|
|
63
63
|
output_data = output.data(self)
|
64
64
|
|
65
65
|
# prefer output-specific level; fall back to general level
|
66
|
-
logger.level = output_data ? output_data.level : @level
|
66
|
+
logger.level = output_data && output_data.level ? output_data.level : @level
|
67
67
|
add_appender(logger, output.to_appender(output_data))
|
68
68
|
|
69
69
|
hash[output_name] = logger
|
data/lib/logsly/version.rb
CHANGED
data/test/unit/logsly_tests.rb
CHANGED
@@ -107,8 +107,14 @@ module Logsly
|
|
107
107
|
class LoggerTests < UnitTests
|
108
108
|
desc "logger"
|
109
109
|
setup do
|
110
|
+
# this populates the `Logsly::Logging182::LEVELS` constant
|
111
|
+
Logsly::Logging182.init
|
112
|
+
|
110
113
|
@logger = TestLogger.new(:testy_log_logger)
|
111
114
|
end
|
115
|
+
teardown do
|
116
|
+
Logsly.reset
|
117
|
+
end
|
112
118
|
subject{ @logger }
|
113
119
|
|
114
120
|
should have_readers :log_type, :level, :outputs, :output_loggers
|
@@ -134,11 +140,14 @@ module Logsly
|
|
134
140
|
assert_equal [:stdout], log.outputs
|
135
141
|
end
|
136
142
|
|
137
|
-
should "
|
143
|
+
should "not have any output loggers by default" do
|
138
144
|
assert_empty subject.output_loggers
|
145
|
+
end
|
139
146
|
|
147
|
+
should "create a Logsly::Logging182::Logger for each output" do
|
140
148
|
outputs = Factory.integer(3).times.map{ Factory.string }
|
141
149
|
log = TestLogger.new(:testy_log_logger, :outputs => outputs)
|
150
|
+
assert_equal outputs.size, log.output_loggers.size
|
142
151
|
outputs.each do |output|
|
143
152
|
logger = log.output_loggers[output]
|
144
153
|
assert_kind_of Logsly::Logging182::Logger, logger
|
@@ -152,6 +161,45 @@ module Logsly
|
|
152
161
|
end
|
153
162
|
end
|
154
163
|
|
164
|
+
should "default a configured outputs level when creating loggers" do
|
165
|
+
output_name = Factory.string
|
166
|
+
Logsly.stdout(output_name){ } # don't set a `level`
|
167
|
+
|
168
|
+
log = TestLogger.new(:testy_log_logger, :outputs => [output_name])
|
169
|
+
logger = log.output_loggers[output_name]
|
170
|
+
assert_kind_of Logsly::Logging182::Logger, logger
|
171
|
+
assert_equal Logsly::Logging182::LEVELS[DEFAULT_LEVEL], logger.level
|
172
|
+
end
|
173
|
+
|
174
|
+
should "use the configured outputs level when creating loggers" do
|
175
|
+
output_name = Factory.string
|
176
|
+
custom_log_level = Logsly::Logging182::LEVELS.keys.choice
|
177
|
+
Logsly.stdout(output_name){ level(custom_log_level) }
|
178
|
+
|
179
|
+
passed_log_level = (Logsly::Logging182::LEVELS.keys - [custom_log_level]).choice
|
180
|
+
log = TestLogger.new(:testy_log_logger, {
|
181
|
+
:level => passed_log_level,
|
182
|
+
:outputs => [output_name]
|
183
|
+
})
|
184
|
+
logger = log.output_loggers[output_name]
|
185
|
+
assert_kind_of Logsly::Logging182::Logger, logger
|
186
|
+
assert_equal Logsly::Logging182::LEVELS[custom_log_level], logger.level
|
187
|
+
end
|
188
|
+
|
189
|
+
should "use a passed output level when creating loggers" do
|
190
|
+
output_name = Factory.string
|
191
|
+
Logsly.stdout(output_name){ } # don't set a `level`
|
192
|
+
|
193
|
+
passed_log_level = Logsly::Logging182::LEVELS.keys.choice
|
194
|
+
log = TestLogger.new(:testy_log_logger, {
|
195
|
+
:level => passed_log_level,
|
196
|
+
:outputs => [output_name]
|
197
|
+
})
|
198
|
+
logger = log.output_loggers[output_name]
|
199
|
+
assert_kind_of Logsly::Logging182::Logger, logger
|
200
|
+
assert_equal Logsly::Logging182::LEVELS[passed_log_level], logger.level
|
201
|
+
end
|
202
|
+
|
155
203
|
should "set mdc key/value pairs" do
|
156
204
|
key = Factory.string
|
157
205
|
assert_nil Logsly::Logging182.mdc[key]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logsly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-11-08 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: assert
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
requirements: []
|
132
132
|
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.6.
|
134
|
+
rubygems_version: 2.6.7
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Create custom loggers.
|