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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ddf4801d5f2a31d107d694a433dcd93583d43cc405ee2347ca8054409705c68
4
- data.tar.gz: d42cd2e291492d13dd458afc25b349a2501dbddfba526af27185ec199cc203b2
3
+ metadata.gz: 3f9c4fa6760b1c737b0f6ed81669bd55da57cadf1f8d10490cd87a1dd8a62276
4
+ data.tar.gz: c36894cf227b89b9484c2783ec49c17b19603feaea4d8bffd769c5557f8b131d
5
5
  SHA512:
6
- metadata.gz: 1db29e10a929c956f8db43abfbd42ac12edf83f10eff23026041e3c1381929bd571f74c9f900337994c980a9eda9ba9e10ca888f67ba986f3727c9897326c98d
7
- data.tar.gz: 55b2c8e12eac1c2a9b7a0ac41ea7df4be72704c4f8b5396fa8c90e13c1682ca6d6711f9ee903bf386a0283bf02cd68dcb1577737998144536ab137dc8e4ba2ac
6
+ metadata.gz: 10f9370e05e660be96f6b073d03ca212bfc1ad4b672bb8e84a2c9fe0dd3d3d13fb86df80454d99dd52922bed0ee935bbd63844c14b377c8458814db70ab76b48
7
+ data.tar.gz: 480f074ae1d5a4a4f0891d9fe1237b595e0edfdc396f85530deac0620f91ce27b774de828656a37531587a46cde6d347a6aac6639ce2b8f82418a1c58a955748
@@ -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?; @level <= DEBUG; end
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?; @level <= INFO; end
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?; @level <= WARN; end
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?; @level <= ERROR; end
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?; @level <= FATAL; end
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 number).
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 < @level
460
+ if @logdev.nil? or severity < level
460
461
  return true
461
462
  end
462
463
  if progname.nil?
@@ -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
- else
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
- else
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Logger
4
- VERSION = "1.4.1"
4
+ VERSION = "1.4.2"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  begin
2
2
  require_relative "lib/logger/version"
3
3
  rescue LoadError # Fallback to load version file in ruby core repository
4
- require_relative "logger/version"
4
+ require_relative "version"
5
5
  end
6
6
 
7
7
  Gem::Specification.new do |spec|
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.1
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-08-20 00:00:00.000000000 Z
12
+ date: 2019-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler