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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51c9f02d787a2ea528d373395735b2a3f442c410b371b3a678cff837245056e2
4
- data.tar.gz: b64fc8ea5f7f8590cf102b6ceb24bf47b113014061b526753ed12a22c8eec166
3
+ metadata.gz: a3ef69b1f08389623edc46eadeecb5caab6cd9cc5cf993b6eddf8f964c3b8908
4
+ data.tar.gz: 5aa92e9108400d33f65c075996498030cd69922ec8d9e568ae8b2cb888954d54
5
5
  SHA512:
6
- metadata.gz: acfa40bed44dc82d44e311cf5a8124c32545176d8361e57e3fa82ae0b6a3bcc20bb3a201a4a6b84338eb6e4fc27d447e8ca8efaad14fe23343cbe24b5e08cbe8
7
- data.tar.gz: 0eb2d0c042f3e926ee34368e9681200f676f30f54860bad8ff636b44c952e3cd94ec86084bbf77966d3ec529e815cb3995eebb71070b6dd10fb7836866f3a6bf
6
+ metadata.gz: b792b58199a032f4cf4e1404f40e5625e5f34b7064b5a32e57299a4a6e285cd6116fce0d84b8a0439a2800052d5f0a931e682c4799e83771bd79ca383a3738a0
7
+ data.tar.gz: e5215e8fa3f9c60928f8526858f0ad2f8f462954a9b39377193aec190cf60ee241ef157560f090be7e7c670d67cfac6dfde4f94e10f26de5d4bd042b5bb182fa
@@ -1,49 +1,23 @@
1
1
  require "ci_logger/registry"
2
2
 
3
3
  module CiLogger
4
- class Logger < ::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
- if @level <= l[:severity]
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 method_missing(symbol, *args, &block)
63
- @original.send(symbol, *args, &block)
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?(symbol, include_all)
67
- @original.respond_to?(symbol, include_all)
70
+ def respond_to_missing?(...)
71
+ @original.respond_to?(...)
68
72
  end
69
73
  end
70
74
  end
@@ -1,3 +1,3 @@
1
1
  module CiLogger
2
- VERSION = '0.7.0'
2
+ VERSION = '0.8.0'
3
3
  end
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.7.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-09-09 00:00:00.000000000 Z
11
+ date: 2023-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties