logger_ext 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: c0390159cf17c35f3152011ab85bfe284a7c1add
4
- data.tar.gz: 02a1fe3f3f37f51de9f530eed571c82f431e5553
3
+ metadata.gz: f3bdb23afe325ceed8256e1a717c4765da54d99f
4
+ data.tar.gz: 6198cdb393388d1971cd930b0bab10f073d35bc8
5
5
  SHA512:
6
- metadata.gz: 56d5a95c99ca53be7855a8b877207e9e89490def02dba596f5faa1eec92c8da011b83da813355f52d449b62ecf1cc1936f23a8e7cdf969b99bc945ad6f5af9b1
7
- data.tar.gz: 8ebaac833865d8ff0c57bd3f47e6fe2de13dd1d986140ad86cd8e18d603d3db71f31eedaa7d6f0eb5d9fcfb283668ef024cf7455a16c7079375127b4d48ddfbd
6
+ metadata.gz: 4f5a715d3534a7b9ce791577900e1d6d8fdfbf900bbb51040c7ff549ce35c2e969afddfcfdb0c85f57c2d0965fa40c252d86919912c87867da031f3653749dfd
7
+ data.tar.gz: 2853552505cc040348abe6825f48a58e6531aa9ce6d4e9ff30ffa2aa2c95ba0f25c27202937035190b8b2c694f7fcb4fe6c4dbfa3cd29dbc9baefdf45b49dbbc
@@ -1,3 +1,3 @@
1
1
  module LoggerExt
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/logger_ext.rb CHANGED
@@ -4,18 +4,18 @@ require "logger"
4
4
  class Logger
5
5
  private
6
6
 
7
- def add_structured_entry(severity, message, *args, &block)
7
+ def log_with_options(severity, *args, &block)
8
8
  return unless level <= severity
9
9
 
10
10
  if block
11
11
  # Note: this will raise an error if args is not empty
12
- add severity, nil, message, *args, &block
12
+ add severity, nil, *args, &block
13
13
  else
14
- add severity, format_structured_entry(message, *args), nil
14
+ add severity, format_message_with_options(*args), nil
15
15
  end
16
16
  end
17
17
 
18
- def format_structured_entry(message, *args)
18
+ def format_message_with_options(message, *args)
19
19
  message += ": #{args.shift.inspect}" unless args.empty?
20
20
  args.each_with_index do |arg, idx|
21
21
  message += ", #{arg.inspect}"
@@ -26,32 +26,32 @@ class Logger
26
26
  public
27
27
 
28
28
  # Log a +DEBUG+ message.
29
- def debug(message, *args, &block)
30
- add_structured_entry(DEBUG, message, *args, &block)
29
+ def debug(*args, &block)
30
+ log_with_options(DEBUG, *args, &block)
31
31
  end
32
32
 
33
33
  # Log an +INFO+ message.
34
- def info(message, *args, &block)
35
- add_structured_entry(INFO, message, *args, &block)
34
+ def info(*args, &block)
35
+ log_with_options(INFO, *args, &block)
36
36
  end
37
37
 
38
38
  # Log a +WARN+ message.
39
- def warn(message, *args, &block)
40
- add_structured_entry(WARN, message, *args, &block)
39
+ def warn(*args, &block)
40
+ log_with_options(WARN, *args, &block)
41
41
  end
42
42
 
43
43
  # Log an +ERROR+ message.
44
- def error(message, *args, &block)
45
- add_structured_entry(ERROR, message, *args, &block)
44
+ def error(*args, &block)
45
+ log_with_options(ERROR, *args, &block)
46
46
  end
47
47
 
48
48
  # Log a +FATAL+ message.
49
- def fatal(message, *args, &block)
50
- add_structured_entry(FATAL, message, *args, &block)
49
+ def fatal(*args, &block)
50
+ log_with_options(FATAL, *args, &block)
51
51
  end
52
52
 
53
53
  # Log an +UNKNOWN+ message.
54
- def unknown(message, *args, &block)
55
- add_structured_entry(UNKNOWN, message, *args, &block)
54
+ def unknown(*args, &block)
55
+ log_with_options(UNKNOWN, *args, &block)
56
56
  end
57
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logger_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-22 00:00:00.000000000 Z
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec