semantic_logger 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/semantic_logger/appender/base.rb +13 -0
- data/lib/semantic_logger/debug_as_trace_logger.rb +18 -0
- data/lib/semantic_logger/version.rb +1 -1
- data/lib/semantic_logger.rb +4 -3
- data/test/debug_as_trace_logger_test.rb +98 -0
- data/test/logger_test.rb +161 -93
- data/test/test_helper.rb +4 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a76d0de5e08c9768042187ab19b2546d5c91b3a
|
4
|
+
data.tar.gz: b04d51de5d531ec57ce382e77ddfd21bd69a420a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fc60fcfef8e8c255720de4a4972ae2f0b919dd022eccc68afef004ad1f3fd0870f6c4adc54d190d0ff109a6671be910dbfafdf63f9ade57e9c8caedc66bead1
|
7
|
+
data.tar.gz: 2c73e2cf3ac75e19097a3acb6b0437df745c4d60e7c8c3a5a02ef846a9b1ba1b16e37b49e07bbde4851c4ba77e63c1d22e027bf65ea3882150c1608f98db0f93
|
@@ -81,6 +81,12 @@ module SemanticLogger
|
|
81
81
|
# An appender can implement a flush method if it supports it.
|
82
82
|
end
|
83
83
|
|
84
|
+
# Returns the current log level if set, otherwise it returns the global
|
85
|
+
# default log level
|
86
|
+
def level
|
87
|
+
@level || :trace
|
88
|
+
end
|
89
|
+
|
84
90
|
############################################################################
|
85
91
|
protected
|
86
92
|
|
@@ -105,6 +111,13 @@ module SemanticLogger
|
|
105
111
|
super(self.class, level, filter)
|
106
112
|
end
|
107
113
|
|
114
|
+
# Return the level index for fast comparisons
|
115
|
+
# Returns the lowest level index if the level has not been explicitly
|
116
|
+
# set for this instance
|
117
|
+
def level_index
|
118
|
+
@level_index || 0
|
119
|
+
end
|
120
|
+
|
108
121
|
# For JRuby include the Thread name rather than its id
|
109
122
|
if defined? Java
|
110
123
|
# Return the Time as a formatted string
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module SemanticLogger
|
2
|
+
# Custom logger that maps all calls to debug to trace calls
|
3
|
+
# This is useful for existing gems / libraries that log too much to debug
|
4
|
+
# when most of the debug logging should be at the trace level
|
5
|
+
class DebugAsTraceLogger < Logger
|
6
|
+
def debug(*args, &block)
|
7
|
+
trace(*args, &block)
|
8
|
+
end
|
9
|
+
|
10
|
+
def debug?
|
11
|
+
trace?
|
12
|
+
end
|
13
|
+
|
14
|
+
def benchmark_debug(*args, &block)
|
15
|
+
benchmark_trace(*args, &block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/semantic_logger.rb
CHANGED
@@ -3,9 +3,10 @@ require 'semantic_logger/version'
|
|
3
3
|
require 'semantic_logger/semantic_logger'
|
4
4
|
|
5
5
|
module SemanticLogger
|
6
|
-
autoload :Base,
|
7
|
-
autoload :Logger,
|
8
|
-
autoload :Loggable,
|
6
|
+
autoload :Base, 'semantic_logger/base'
|
7
|
+
autoload :Logger, 'semantic_logger/logger'
|
8
|
+
autoload :Loggable, 'semantic_logger/loggable'
|
9
|
+
autoload :DebugAsTraceLogger, 'semantic_logger/debug_as_trace_logger'
|
9
10
|
|
10
11
|
module Appender
|
11
12
|
autoload :Base, 'semantic_logger/appender/base'
|
@@ -0,0 +1,98 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
# Unit Test for SemanticLogger::Logger
|
5
|
+
class DebugAsTraceLoggerTest < Minitest::Test
|
6
|
+
context SemanticLogger::Logger do
|
7
|
+
# Test each filter
|
8
|
+
[ nil, /\ADebugAsTraceLoggerTest/, Proc.new{|l| (/\AExclude/ =~ l.message).nil? } ].each do |filter|
|
9
|
+
context "filter: #{filter.class.name}" do
|
10
|
+
setup do
|
11
|
+
# Use a mock logger that just keeps the last logged entry in an instance
|
12
|
+
# variable
|
13
|
+
SemanticLogger.default_level = :trace
|
14
|
+
@mock_logger = MockLogger.new
|
15
|
+
appender = SemanticLogger.add_appender(@mock_logger)
|
16
|
+
appender.filter = filter
|
17
|
+
|
18
|
+
# Use this test's class name as the application name in the log output
|
19
|
+
@logger = SemanticLogger::DebugAsTraceLogger.new(self.class)
|
20
|
+
@hash = { :session_id => 'HSSKLEU@JDK767', :tracking_number => 12345 }
|
21
|
+
@hash_str = @hash.inspect.sub("{", "\\{").sub("}", "\\}")
|
22
|
+
assert_equal [], @logger.tags
|
23
|
+
end
|
24
|
+
|
25
|
+
teardown do
|
26
|
+
# Remove all appenders
|
27
|
+
SemanticLogger.appenders.each{|appender| SemanticLogger.remove_appender(appender)}
|
28
|
+
end
|
29
|
+
|
30
|
+
context '.level?' do
|
31
|
+
should 'return true for debug? with :trace level' do
|
32
|
+
SemanticLogger.default_level = :trace
|
33
|
+
assert_equal :trace, @logger.level
|
34
|
+
assert_equal true, @logger.debug?
|
35
|
+
assert_equal true, @logger.trace?
|
36
|
+
end
|
37
|
+
|
38
|
+
should 'return false for debug? with global :debug level' do
|
39
|
+
SemanticLogger.default_level = :debug
|
40
|
+
assert_equal :debug, @logger.level, @logger.inspect
|
41
|
+
assert_equal false, @logger.debug?, @logger.inspect
|
42
|
+
assert_equal false, @logger.trace?, @logger.inspect
|
43
|
+
end
|
44
|
+
|
45
|
+
should 'return true for debug? with global :info level' do
|
46
|
+
SemanticLogger.default_level = :info
|
47
|
+
assert_equal :info, @logger.level, @logger.inspect
|
48
|
+
assert_equal false, @logger.debug?, @logger.inspect
|
49
|
+
assert_equal false, @logger.trace?, @logger.inspect
|
50
|
+
end
|
51
|
+
|
52
|
+
should 'return false for debug? with instance :debug level' do
|
53
|
+
@logger.level = :debug
|
54
|
+
assert_equal :debug, @logger.level, @logger.inspect
|
55
|
+
assert_equal false, @logger.debug?, @logger.inspect
|
56
|
+
assert_equal false, @logger.trace?, @logger.inspect
|
57
|
+
end
|
58
|
+
|
59
|
+
should 'return true for debug? with instance :info level' do
|
60
|
+
@logger.level = :info
|
61
|
+
assert_equal :info, @logger.level, @logger.inspect
|
62
|
+
assert_equal false, @logger.debug?, @logger.inspect
|
63
|
+
assert_equal false, @logger.trace?, @logger.inspect
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
should 'not log trace when level is debug' do
|
68
|
+
@logger.level = :debug
|
69
|
+
@logger.trace('hello world', @hash) { "Calculations" }
|
70
|
+
SemanticLogger.flush
|
71
|
+
assert_nil @mock_logger.message
|
72
|
+
end
|
73
|
+
|
74
|
+
should 'not log debug when level is debug' do
|
75
|
+
@logger.level = :debug
|
76
|
+
@logger.debug('hello world', @hash) { "Calculations" }
|
77
|
+
SemanticLogger.flush
|
78
|
+
assert_nil @mock_logger.message
|
79
|
+
end
|
80
|
+
|
81
|
+
should 'map trace to debug' do
|
82
|
+
@logger.level = :trace
|
83
|
+
@logger.debug('hello world', @hash) { "Calculations" }
|
84
|
+
SemanticLogger.flush
|
85
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ T \[\d+:.+\] DebugAsTraceLoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message
|
86
|
+
end
|
87
|
+
|
88
|
+
should 'log trace as trace' do
|
89
|
+
@logger.level = :trace
|
90
|
+
@logger.trace('hello world', @hash) { "Calculations" }
|
91
|
+
SemanticLogger.flush
|
92
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ T \[\d+:.+\] DebugAsTraceLoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
data/test/logger_test.rb
CHANGED
@@ -97,128 +97,196 @@ class LoggerTest < Minitest::Test
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
100
|
+
end
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
end
|
102
|
+
context "Ruby Logger" do
|
103
|
+
# Ensure that any log level can be logged
|
104
|
+
Logger::Severity.constants.each do |level|
|
105
|
+
should "log Ruby logger #{level} info" do
|
106
|
+
@logger.level = Logger::Severity.const_get(level)
|
107
|
+
if level.to_s == 'UNKNOWN'
|
108
|
+
assert_equal Logger::Severity.const_get('ERROR')+1, @logger.send(:level_index)
|
109
|
+
else
|
110
|
+
assert_equal Logger::Severity.const_get(level)+1, @logger.send(:level_index)
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
114
|
+
end
|
114
115
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
116
|
+
context "benchmark" do
|
117
|
+
# Ensure that any log level can be benchmarked and logged
|
118
|
+
SemanticLogger::LEVELS.each do |level|
|
119
|
+
level_char = level.to_s.upcase[0]
|
119
120
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
context 'direct method' do
|
122
|
+
should "log #{level} info" do
|
123
|
+
assert_equal "result", @logger.send("benchmark_#{level}".to_sym, 'hello world') { "result" } # Measure duration of the supplied block
|
124
|
+
SemanticLogger.flush
|
125
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world/, @mock_logger.message
|
126
|
+
end
|
126
127
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
128
|
+
should "log #{level} info with payload" do
|
129
|
+
assert_equal "result", @logger.send("benchmark_#{level}".to_sym, 'hello world', payload: @hash) { "result" } # Measure duration of the supplied block
|
130
|
+
SemanticLogger.flush
|
131
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- #{@hash_str}/, @mock_logger.message
|
132
|
+
end
|
132
133
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
134
|
+
should "not log #{level} info when block is faster than :min_duration" do
|
135
|
+
assert_equal "result", @logger.send("benchmark_#{level}".to_sym, 'hello world', :min_duration => 500) { "result" } # Measure duration of the supplied block
|
136
|
+
SemanticLogger.flush
|
137
|
+
assert_nil @mock_logger.message
|
138
|
+
end
|
138
139
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
140
|
+
should "log #{level} info when block duration exceeds :min_duration" do
|
141
|
+
assert_equal "result", @logger.send("benchmark_#{level}".to_sym, 'hello world', :min_duration => 200, payload: @hash) { sleep 0.5; "result" } # Measure duration of the supplied block
|
142
|
+
SemanticLogger.flush
|
143
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- #{@hash_str}/, @mock_logger.message
|
144
|
+
end
|
144
145
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
end
|
149
|
-
SemanticLogger.flush
|
150
|
-
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- Exception: RuntimeError: Test -- #{@hash_str}/, @mock_logger.message
|
146
|
+
should "log #{level} info with an exception" do
|
147
|
+
assert_raises RuntimeError do
|
148
|
+
@logger.send("benchmark_#{level}", 'hello world', payload: @hash) { raise RuntimeError.new("Test") } # Measure duration of the supplied block
|
151
149
|
end
|
150
|
+
SemanticLogger.flush
|
151
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- Exception: RuntimeError: Test -- #{@hash_str}/, @mock_logger.message
|
152
|
+
end
|
152
153
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
end
|
157
|
-
SemanticLogger.flush
|
158
|
-
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ F \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- Exception: RuntimeError: Test -- #{@hash_str}/, @mock_logger.message
|
154
|
+
should "change log #{level} info with an exception" do
|
155
|
+
assert_raises RuntimeError do
|
156
|
+
@logger.send("benchmark_#{level}", 'hello world', payload: @hash, on_exception_level: :fatal) { raise RuntimeError.new("Test") } # Measure duration of the supplied block
|
159
157
|
end
|
158
|
+
SemanticLogger.flush
|
159
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ F \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- Exception: RuntimeError: Test -- #{@hash_str}/, @mock_logger.message
|
160
|
+
end
|
160
161
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
end
|
162
|
+
should "log #{level} info with metric" do
|
163
|
+
metric_name = '/my/custom/metric'
|
164
|
+
assert_equal "result", @logger.send("benchmark_#{level}".to_sym, 'hello world', :metric => metric_name) { "result" } # Measure duration of the supplied block
|
165
|
+
SemanticLogger.flush
|
166
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world/, @mock_logger.message
|
167
|
+
assert metric_name, $last_metric.metric
|
168
168
|
end
|
169
|
+
end
|
169
170
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
171
|
+
context 'generic method' do
|
172
|
+
should "log #{level} info" do
|
173
|
+
assert_equal "result", @logger.benchmark(level, 'hello world') { "result" } # Measure duration of the supplied block
|
174
|
+
SemanticLogger.flush
|
175
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world/, @mock_logger.message
|
176
|
+
end
|
176
177
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
178
|
+
should "log #{level} info with payload" do
|
179
|
+
assert_equal "result", @logger.benchmark(level, 'hello world', payload: @hash) { "result" } # Measure duration of the supplied block
|
180
|
+
SemanticLogger.flush
|
181
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- #{@hash_str}/, @mock_logger.message
|
182
|
+
end
|
182
183
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
184
|
+
should "not log #{level} info when block is faster than :min_duration" do
|
185
|
+
assert_equal "result", @logger.benchmark(level, 'hello world', :min_duration => 500) { "result" } # Measure duration of the supplied block
|
186
|
+
SemanticLogger.flush
|
187
|
+
assert_nil @mock_logger.message
|
188
|
+
end
|
188
189
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
190
|
+
should "log #{level} info when block duration exceeds :min_duration" do
|
191
|
+
assert_equal "result", @logger.benchmark(level, 'hello world', :min_duration => 200, payload: @hash) { sleep 0.5; "result" } # Measure duration of the supplied block
|
192
|
+
SemanticLogger.flush
|
193
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- #{@hash_str}/, @mock_logger.message
|
194
|
+
end
|
194
195
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
end
|
199
|
-
SemanticLogger.flush
|
200
|
-
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- Exception: RuntimeError: Test -- #{@hash_str}/, @mock_logger.message
|
196
|
+
should "log #{level} info with an exception" do
|
197
|
+
assert_raises RuntimeError do
|
198
|
+
@logger.benchmark(level, 'hello world', payload: @hash) { raise RuntimeError.new("Test") } # Measure duration of the supplied block
|
201
199
|
end
|
200
|
+
SemanticLogger.flush
|
201
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- Exception: RuntimeError: Test -- #{@hash_str}/, @mock_logger.message
|
202
|
+
end
|
202
203
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
end
|
204
|
+
should "log #{level} info with metric" do
|
205
|
+
metric_name = '/my/custom/metric'
|
206
|
+
assert_equal "result", @logger.benchmark(level, 'hello world', :metric => metric_name) { "result" } # Measure duration of the supplied block
|
207
|
+
SemanticLogger.flush
|
208
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ #{level_char} \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world/, @mock_logger.message
|
209
|
+
assert metric_name, $last_metric.metric
|
210
210
|
end
|
211
211
|
end
|
212
|
+
end
|
212
213
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
214
|
+
should "log when the block performs a return" do
|
215
|
+
assert_equal "Good", function_with_return(@logger)
|
216
|
+
SemanticLogger.flush
|
217
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ I \[\d+:.+\] \(\d+\.\dms\) LoggerTest -- hello world -- #{@hash_str}/, @mock_logger.message
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
context '.default_level' do
|
222
|
+
setup do
|
223
|
+
SemanticLogger.default_level = :debug
|
224
|
+
end
|
225
|
+
|
226
|
+
should 'not log at a level below the global default' do
|
227
|
+
assert_equal :debug, @logger.level
|
228
|
+
@logger.trace('hello world', @hash) { "Calculations" }
|
229
|
+
SemanticLogger.flush
|
230
|
+
assert_nil @mock_logger.message
|
231
|
+
end
|
232
|
+
|
233
|
+
should 'log at the instance level' do
|
234
|
+
@logger.level = :trace
|
235
|
+
assert_equal :trace, @logger.level
|
236
|
+
@logger.trace('hello world', @hash) { "Calculations" }
|
237
|
+
SemanticLogger.flush
|
238
|
+
assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ T \[\d+:.+\] LoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message
|
239
|
+
end
|
240
|
+
|
241
|
+
should 'not log at a level below the instance level' do
|
242
|
+
@logger.level = :warn
|
243
|
+
assert_equal :warn, @logger.level
|
244
|
+
@logger.debug('hello world', @hash) { "Calculations" }
|
245
|
+
SemanticLogger.flush
|
246
|
+
assert_nil @mock_logger.message
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
context '.level?' do
|
251
|
+
should 'return true for debug? with :trace level' do
|
252
|
+
SemanticLogger.default_level = :trace
|
253
|
+
assert_equal :trace, @logger.level
|
254
|
+
assert_equal true, @logger.debug?
|
255
|
+
assert_equal true, @logger.trace?
|
256
|
+
end
|
257
|
+
|
258
|
+
should 'return false for debug? with global :debug level' do
|
259
|
+
SemanticLogger.default_level = :debug
|
260
|
+
assert_equal :debug, @logger.level, @logger.inspect
|
261
|
+
assert_equal true, @logger.debug?, @logger.inspect
|
262
|
+
assert_equal false, @logger.trace?, @logger.inspect
|
263
|
+
end
|
264
|
+
|
265
|
+
should 'return true for debug? with global :info level' do
|
266
|
+
SemanticLogger.default_level = :info
|
267
|
+
assert_equal :info, @logger.level, @logger.inspect
|
268
|
+
assert_equal false, @logger.debug?, @logger.inspect
|
269
|
+
assert_equal false, @logger.trace?, @logger.inspect
|
270
|
+
end
|
271
|
+
|
272
|
+
should 'return false for debug? with instance :debug level' do
|
273
|
+
@logger.level = :debug
|
274
|
+
assert_equal :debug, @logger.level, @logger.inspect
|
275
|
+
assert_equal true, @logger.debug?, @logger.inspect
|
276
|
+
assert_equal false, @logger.trace?, @logger.inspect
|
277
|
+
end
|
278
|
+
|
279
|
+
should 'return true for debug? with instance :info level' do
|
280
|
+
@logger.level = :info
|
281
|
+
assert_equal :info, @logger.level, @logger.inspect
|
282
|
+
assert_equal false, @logger.debug?, @logger.inspect
|
283
|
+
assert_equal false, @logger.trace?, @logger.inspect
|
218
284
|
end
|
219
285
|
end
|
286
|
+
|
220
287
|
end
|
221
288
|
end
|
289
|
+
|
222
290
|
end
|
223
291
|
|
224
292
|
# Make sure that benchmark still logs when a block uses return to return from
|
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# Allow test to be run in-place without requiring a gem install
|
2
2
|
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
3
3
|
|
4
|
-
#
|
4
|
+
# Configure Rails Environment
|
5
|
+
ENV['RAILS_ENV'] = 'test'
|
6
|
+
|
5
7
|
require 'minitest/autorun'
|
6
8
|
require 'minitest/reporters'
|
7
9
|
require 'minitest/stub_any_instance'
|
@@ -10,4 +12,4 @@ require 'semantic_logger'
|
|
10
12
|
require 'logger'
|
11
13
|
require 'mock_logger'
|
12
14
|
|
13
|
-
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
15
|
+
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sync_attr
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/semantic_logger/appender/wrapper.rb
|
60
60
|
- lib/semantic_logger/base.rb
|
61
61
|
- lib/semantic_logger/core_ext/thread.rb
|
62
|
+
- lib/semantic_logger/debug_as_trace_logger.rb
|
62
63
|
- lib/semantic_logger/loggable.rb
|
63
64
|
- lib/semantic_logger/logger.rb
|
64
65
|
- lib/semantic_logger/semantic_logger.rb
|
@@ -69,6 +70,7 @@ files:
|
|
69
70
|
- test/appender_splunk_test.rb
|
70
71
|
- test/appender_syslog_test.rb
|
71
72
|
- test/appender_wrapper_test.rb
|
73
|
+
- test/debug_as_trace_logger_test.rb
|
72
74
|
- test/loggable_test.rb
|
73
75
|
- test/logger_test.rb
|
74
76
|
- test/mock_logger.rb
|
@@ -105,6 +107,7 @@ test_files:
|
|
105
107
|
- test/appender_splunk_test.rb
|
106
108
|
- test/appender_syslog_test.rb
|
107
109
|
- test/appender_wrapper_test.rb
|
110
|
+
- test/debug_as_trace_logger_test.rb
|
108
111
|
- test/loggable_test.rb
|
109
112
|
- test/logger_test.rb
|
110
113
|
- test/mock_logger.rb
|