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 +4 -4
- data/lib/logger_ext/version.rb +1 -1
- data/lib/logger_ext.rb +16 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3bdb23afe325ceed8256e1a717c4765da54d99f
|
4
|
+
data.tar.gz: 6198cdb393388d1971cd930b0bab10f073d35bc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f5a715d3534a7b9ce791577900e1d6d8fdfbf900bbb51040c7ff549ce35c2e969afddfcfdb0c85f57c2d0965fa40c252d86919912c87867da031f3653749dfd
|
7
|
+
data.tar.gz: 2853552505cc040348abe6825f48a58e6531aa9ce6d4e9ff30ffa2aa2c95ba0f25c27202937035190b8b2c694f7fcb4fe6c4dbfa3cd29dbc9baefdf45b49dbbc
|
data/lib/logger_ext/version.rb
CHANGED
data/lib/logger_ext.rb
CHANGED
@@ -4,18 +4,18 @@ require "logger"
|
|
4
4
|
class Logger
|
5
5
|
private
|
6
6
|
|
7
|
-
def
|
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,
|
12
|
+
add severity, nil, *args, &block
|
13
13
|
else
|
14
|
-
add severity,
|
14
|
+
add severity, format_message_with_options(*args), nil
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
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(
|
30
|
-
|
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(
|
35
|
-
|
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(
|
40
|
-
|
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(
|
45
|
-
|
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(
|
50
|
-
|
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(
|
55
|
-
|
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.
|
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:
|
11
|
+
date: 2017-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|