ci_logger 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ci_logger/logger.rb +36 -32
- data/lib/ci_logger/version.rb +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: a3ef69b1f08389623edc46eadeecb5caab6cd9cc5cf993b6eddf8f964c3b8908
|
4
|
+
data.tar.gz: 5aa92e9108400d33f65c075996498030cd69922ec8d9e568ae8b2cb888954d54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b792b58199a032f4cf4e1404f40e5625e5f34b7064b5a32e57299a4a6e285cd6116fce0d84b8a0439a2800052d5f0a931e682c4799e83771bd79ca383a3738a0
|
7
|
+
data.tar.gz: e5215e8fa3f9c60928f8526858f0ad2f8f462954a9b39377193aec190cf60ee241ef157560f090be7e7c670d67cfac6dfde4f94e10f26de5d4bd042b5bb182fa
|
data/lib/ci_logger/logger.rb
CHANGED
@@ -1,49 +1,23 @@
|
|
1
1
|
require "ci_logger/registry"
|
2
2
|
|
3
3
|
module CiLogger
|
4
|
-
class Logger
|
4
|
+
class Logger
|
5
5
|
def initialize(original)
|
6
6
|
@original = original
|
7
|
-
@original_level = @original.level
|
8
|
-
@original.level = :debug
|
9
|
-
self.level = :debug
|
10
7
|
Registry.register(self)
|
11
8
|
end
|
12
9
|
|
13
10
|
def sync
|
14
11
|
temporary_log.each do |l|
|
15
|
-
|
16
|
-
@original.add(l[:severity], l[:message], l[:progname])
|
17
|
-
end
|
12
|
+
@original.add(l[:severity], l[:message], l[:progname])
|
18
13
|
end
|
19
14
|
temporary_log.clear
|
20
15
|
end
|
21
16
|
|
22
|
-
def sync_with_original_level
|
23
|
-
@original.level = @original_level
|
24
|
-
sync
|
25
|
-
ensure
|
26
|
-
@original.level = :debug
|
27
|
-
end
|
28
|
-
|
29
17
|
def clear
|
30
18
|
temporary_log.clear
|
31
19
|
end
|
32
20
|
|
33
|
-
def formatter
|
34
|
-
@original.formatter
|
35
|
-
end
|
36
|
-
|
37
|
-
def formatter=(f)
|
38
|
-
@original.formatter = f
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def temporary_log
|
44
|
-
@temporary_log ||= []
|
45
|
-
end
|
46
|
-
|
47
21
|
def add(severity, message = nil, progname = nil)
|
48
22
|
if progname.nil?
|
49
23
|
progname = @progname
|
@@ -59,12 +33,42 @@ module CiLogger
|
|
59
33
|
temporary_log << { severity: severity, message: message, progname: progname }
|
60
34
|
end
|
61
35
|
|
62
|
-
def
|
63
|
-
|
36
|
+
def debug(progname = nil, &block)
|
37
|
+
add(::Logger::DEBUG, nil, progname, &block)
|
38
|
+
end
|
39
|
+
|
40
|
+
def info(progname = nil, &block)
|
41
|
+
add(::Logger::INFO, nil, progname, &block)
|
42
|
+
end
|
43
|
+
|
44
|
+
def warn(progname = nil, &block)
|
45
|
+
add(::Logger::WARN, nil, progname, &block)
|
46
|
+
end
|
47
|
+
|
48
|
+
def error(progname = nil, &block)
|
49
|
+
add(::Logger::ERROR, nil, progname, &block)
|
50
|
+
end
|
51
|
+
|
52
|
+
def fatal(progname = nil, &block)
|
53
|
+
add(::Logger::FATAL, nil, progname, &block)
|
54
|
+
end
|
55
|
+
|
56
|
+
def unknown(progname = nil, &block)
|
57
|
+
add(::Logger::UNKNOWN, nil, progname, &block)
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def temporary_log
|
63
|
+
@temporary_log ||= []
|
64
|
+
end
|
65
|
+
|
66
|
+
def method_missing(...)
|
67
|
+
@original.send(...)
|
64
68
|
end
|
65
69
|
|
66
|
-
def respond_to_missing?(
|
67
|
-
@original.respond_to?(
|
70
|
+
def respond_to_missing?(...)
|
71
|
+
@original.respond_to?(...)
|
68
72
|
end
|
69
73
|
end
|
70
74
|
end
|
data/lib/ci_logger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- willnet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|