logger 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logger.rb +10 -9
- data/lib/logger/period.rb +6 -2
- data/lib/logger/version.rb +1 -1
- data/logger.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f9c4fa6760b1c737b0f6ed81669bd55da57cadf1f8d10490cd87a1dd8a62276
|
4
|
+
data.tar.gz: c36894cf227b89b9484c2783ec49c17b19603feaea4d8bffd769c5557f8b131d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10f9370e05e660be96f6b073d03ca212bfc1ad4b672bb8e84a2c9fe0dd3d3d13fb86df80454d99dd52922bed0ee935bbd63844c14b377c8458814db70ab76b48
|
7
|
+
data.tar.gz: 480f074ae1d5a4a4f0891d9fe1237b595e0edfdc396f85530deac0620f91ce27b774de828656a37531587a46cde6d347a6aac6639ce2b8f82418a1c58a955748
|
data/lib/logger.rb
CHANGED
@@ -304,35 +304,35 @@ class Logger
|
|
304
304
|
|
305
305
|
# Returns +true+ iff the current severity level allows for the printing of
|
306
306
|
# +DEBUG+ messages.
|
307
|
-
def debug?;
|
307
|
+
def debug?; level <= DEBUG; end
|
308
308
|
|
309
309
|
# Sets the severity to DEBUG.
|
310
310
|
def debug!; self.level = DEBUG; end
|
311
311
|
|
312
312
|
# Returns +true+ iff the current severity level allows for the printing of
|
313
313
|
# +INFO+ messages.
|
314
|
-
def info?;
|
314
|
+
def info?; level <= INFO; end
|
315
315
|
|
316
316
|
# Sets the severity to INFO.
|
317
317
|
def info!; self.level = INFO; end
|
318
318
|
|
319
319
|
# Returns +true+ iff the current severity level allows for the printing of
|
320
320
|
# +WARN+ messages.
|
321
|
-
def warn?;
|
321
|
+
def warn?; level <= WARN; end
|
322
322
|
|
323
323
|
# Sets the severity to WARN.
|
324
324
|
def warn!; self.level = WARN; end
|
325
325
|
|
326
326
|
# Returns +true+ iff the current severity level allows for the printing of
|
327
327
|
# +ERROR+ messages.
|
328
|
-
def error?;
|
328
|
+
def error?; level <= ERROR; end
|
329
329
|
|
330
330
|
# Sets the severity to ERROR.
|
331
331
|
def error!; self.level = ERROR; end
|
332
332
|
|
333
333
|
# Returns +true+ iff the current severity level allows for the printing of
|
334
334
|
# +FATAL+ messages.
|
335
|
-
def fatal?;
|
335
|
+
def fatal?; level <= FATAL; end
|
336
336
|
|
337
337
|
# Sets the severity to FATAL.
|
338
338
|
def fatal!; self.level = FATAL; end
|
@@ -353,10 +353,11 @@ class Logger
|
|
353
353
|
# +STDOUT+, +STDERR+, or an open file).
|
354
354
|
# +shift_age+::
|
355
355
|
# Number of old log files to keep, *or* frequency of rotation (+daily+,
|
356
|
-
# +weekly+ or +monthly+). Default value is 0
|
356
|
+
# +weekly+ or +monthly+). Default value is 0, which disables log file
|
357
|
+
# rotation.
|
357
358
|
# +shift_size+::
|
358
|
-
# Maximum logfile size in bytes (only applies when +shift_age+ is a
|
359
|
-
# Defaults to +1048576+ (1MB).
|
359
|
+
# Maximum logfile size in bytes (only applies when +shift_age+ is a positive
|
360
|
+
# Integer). Defaults to +1048576+ (1MB).
|
360
361
|
# +level+::
|
361
362
|
# Logging severity threshold. Default values is Logger::DEBUG.
|
362
363
|
# +progname+::
|
@@ -456,7 +457,7 @@ class Logger
|
|
456
457
|
#
|
457
458
|
def add(severity, message = nil, progname = nil)
|
458
459
|
severity ||= UNKNOWN
|
459
|
-
if @logdev.nil? or severity <
|
460
|
+
if @logdev.nil? or severity < level
|
460
461
|
return true
|
461
462
|
end
|
462
463
|
if progname.nil?
|
data/lib/logger/period.rb
CHANGED
@@ -15,8 +15,10 @@ class Logger
|
|
15
15
|
when 'monthly'
|
16
16
|
t = Time.mktime(now.year, now.month, 1) + SiD * 32
|
17
17
|
return Time.mktime(t.year, t.month, 1)
|
18
|
-
|
18
|
+
when 'now', 'everytime'
|
19
19
|
return now
|
20
|
+
else
|
21
|
+
raise ArgumentError, "invalid :shift_age #{shift_age.inspect}, should be daily, weekly, monthly, or everytime"
|
20
22
|
end
|
21
23
|
if t.hour.nonzero? or t.min.nonzero? or t.sec.nonzero?
|
22
24
|
hour = t.hour
|
@@ -34,8 +36,10 @@ class Logger
|
|
34
36
|
t = Time.mktime(now.year, now.month, now.mday) - (SiD * now.wday + SiD / 2)
|
35
37
|
when 'monthly'
|
36
38
|
t = Time.mktime(now.year, now.month, 1) - SiD / 2
|
37
|
-
|
39
|
+
when 'now', 'everytime'
|
38
40
|
return now
|
41
|
+
else
|
42
|
+
raise ArgumentError, "invalid :shift_age #{shift_age.inspect}, should be daily, weekly, monthly, or everytime"
|
39
43
|
end
|
40
44
|
Time.mktime(t.year, t.month, t.mday, 23, 59, 59)
|
41
45
|
end
|
data/lib/logger/version.rb
CHANGED
data/logger.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|