contextual_logger 0.5.0 → 0.5.1.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/contextual_logger.rb +19 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc1bc39461eb0dd1ba1a76df5ed2bb4b9f693cf7
|
4
|
+
data.tar.gz: ca4b6f5152b8e863e5f94b67ccea99c0396b6e9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2b7152f692ed66a50af3688584ae278038a051335e0fa6e9498eeba0c58fb7d2f186c30f06ec72751034334f9d2e8b7410d69ee454d96416853af8c49348a9c
|
7
|
+
data.tar.gz: 618dda35bbafe38dedc55fec558f138161cfb137302e0b7c7d7af4de0b64a891795dbaa1f0b46358ae60da451d5abe537ddb22501f53318a58f05482baad80c1
|
data/lib/contextual_logger.rb
CHANGED
@@ -59,38 +59,48 @@ module ContextualLogger
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def debug(message = nil, context = {})
|
62
|
-
|
62
|
+
add(Logger::Severity::DEBUG, message || yield, **context)
|
63
63
|
end
|
64
64
|
|
65
65
|
def info(message = nil, context = {})
|
66
|
-
|
66
|
+
add(Logger::Severity::INFO, message || yield, **context)
|
67
67
|
end
|
68
68
|
|
69
69
|
def warn(message = nil, context = {})
|
70
|
-
|
70
|
+
add(Logger::Severity::WARN, message || yield, **context)
|
71
71
|
end
|
72
72
|
|
73
73
|
def error(message = nil, context = {})
|
74
|
-
|
74
|
+
add(Logger::Severity::ERROR, message || yield, **context)
|
75
75
|
end
|
76
76
|
|
77
77
|
def fatal(message = nil, context = {})
|
78
|
-
|
78
|
+
add(Logger::Severity::FATAL, message || yield, **context)
|
79
79
|
end
|
80
80
|
|
81
81
|
def unknown(message = nil, context = {})
|
82
|
-
|
82
|
+
add(Logger::Severity::UNKNOWN, message || yield, **context)
|
83
83
|
end
|
84
84
|
|
85
85
|
def log_level_enabled?(severity)
|
86
86
|
severity >= level
|
87
87
|
end
|
88
88
|
|
89
|
-
def
|
89
|
+
def add(init_severity, message = nil, init_progname = nil, **context) # Ruby will prefer to match hashes up to last ** argument
|
90
|
+
severity = init_severity || UNKNOWN
|
90
91
|
if log_level_enabled?(severity)
|
91
|
-
|
92
|
-
|
92
|
+
progname = init_progname || @progname
|
93
|
+
if message.nil?
|
94
|
+
if block_given?
|
95
|
+
message = yield
|
96
|
+
else
|
97
|
+
message = init_progname
|
98
|
+
progname = @progname
|
99
|
+
end
|
100
|
+
end
|
101
|
+
write_entry_to_log(severity, Time.now, progname, message, context: current_context_for_thread.deep_merge(context))
|
93
102
|
end
|
103
|
+
|
94
104
|
true
|
95
105
|
end
|
96
106
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contextual_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Ebentier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -65,9 +65,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
65
|
version: '0'
|
66
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- - "
|
68
|
+
- - ">"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: 1.3.1
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
73
|
rubygems_version: 2.6.13
|