console 1.14.0 → 1.15.2

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: 43a78b129f0b1f778d063513a3726aaa832390761f3987fb3b1b77286f51af1a
4
- data.tar.gz: b790c9b840bd37bfcbd6e7f98de70e45bf2d27d049c54b2f9763070edc318a2c
3
+ metadata.gz: '07853910049e6c4b4412a73df16de18a7cf0887acff4fe36ec08cd00cd106370'
4
+ data.tar.gz: a83887255288e5174827784e45929d384e8f7b1c3f98e3c5d8234a8348c1da7d
5
5
  SHA512:
6
- metadata.gz: f58e0e37313d0388c439c80a06e3583f57fa96271be8bd1f1e28e3f4a973ba46618143629af6474bc812b8395c51ace42af4de6a5dcc92f281eba9ce1d66d40a
7
- data.tar.gz: b472be4850adac00472c1abfcadf3f65fc3d1ad4c180d51eb7ef15cf71831757cc411f393b40ca5b71155d9881bb83a445b3fca1ab481e2a2ae93ada1da62158
6
+ metadata.gz: d8a9db4ebbd0ac263ae8e9081698bea9e8ed67af699de82eb5ff860f369c0c074049af827b207c62724cb4518be1b761c78142784f55023abf660a0c0f8c9cda
7
+ data.tar.gz: 1d2435e602df0b8992e5de30d6cf0a9f2784faab165b437c40fe3a86eb16d17b1e246ebc5a70962da6f7b70bf5ce3bd43f6685e8bb1be81700bb2c7dbb1bdb0c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require 'logger'
24
+
25
+ module Console
26
+ module Compatible
27
+ class Logger < ::Logger
28
+ class LogDevice
29
+ def initialize(subject, output)
30
+ @subject = subject
31
+ @output = output
32
+ end
33
+
34
+ def write(message)
35
+ @output.call(@subject, message)
36
+ end
37
+
38
+ def call(*arguments, **options)
39
+ @output.call(*arguments, **options)
40
+ end
41
+
42
+ def reopen
43
+ end
44
+
45
+ def close
46
+ end
47
+ end
48
+
49
+ def initialize(subject, output)
50
+ super(nil)
51
+
52
+ @progname = subject
53
+ @logdev = LogDevice.new(subject, output)
54
+ end
55
+
56
+ def add(severity, message = nil, progname = nil)
57
+ severity ||= UNKNOWN
58
+
59
+ if @logdev.nil? or severity < level
60
+ return true
61
+ end
62
+
63
+ if progname.nil?
64
+ progname = @progname
65
+ end
66
+
67
+ if message.nil?
68
+ if block_given?
69
+ message = yield
70
+ else
71
+ message = progname
72
+ progname = @progname
73
+ end
74
+ end
75
+
76
+ @logdev.call(
77
+ progname, message,
78
+ severity: format_severity(severity)
79
+ )
80
+
81
+ return true
82
+ end
83
+
84
+ def format_severity(value)
85
+ super.downcase
86
+ end
87
+ end
88
+ end
89
+ end
@@ -24,7 +24,7 @@ require_relative 'filter'
24
24
 
25
25
  module Console
26
26
  class Resolver
27
- # You can change the log level for different classes using CONSOLE_<LEVEL> env vars.
27
+ # You can change the log level for different classes using CONSOLE_$LEVEL env vars.
28
28
  #
29
29
  # e.g. `CONSOLE_WARN=Acorn,Banana CONSOLE_DEBUG=Cat` will set the log level for the classes Acorn and Banana to `warn` and Cat to `debug`. This overrides the default log level.
30
30
  #
@@ -36,7 +36,7 @@ module Console
36
36
  # @returns [Nil] If there were no custom logging levels specified in the environment.
37
37
  # @returns [Resolver] If there were custom logging levels, then the created resolver is returned.
38
38
  def self.default_resolver(logger, env = ENV)
39
- # Find all CONSOLE_<LEVEL> variables from environment:
39
+ # Find all CONSOLE_$LEVEL variables from environment:
40
40
  levels = logger.class::LEVELS
41
41
  .map{|label, level| [level, env["CONSOLE_#{label.upcase}"]&.split(',')]}
42
42
  .to_h
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Console
24
- VERSION = "1.14.0"
24
+ VERSION = "1.15.2"
25
25
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,10 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
+ - Robert Schulze
9
+ - Bryan Powell
10
+ - Michael Adams
11
+ - Cyril Roelandt
12
+ - Cédric Boutillier
13
+ - Olle Jonsson
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain:
@@ -36,7 +42,7 @@ cert_chain:
36
42
  RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
37
43
  HiLJ8VOFx6w=
38
44
  -----END CERTIFICATE-----
39
- date: 2021-11-19 00:00:00.000000000 Z
45
+ date: 2022-05-12 00:00:00.000000000 Z
40
46
  dependencies:
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: fiber-local
@@ -133,6 +139,7 @@ files:
133
139
  - lib/console/buffer.rb
134
140
  - lib/console/capture.rb
135
141
  - lib/console/clock.rb
142
+ - lib/console/compatible/logger.rb
136
143
  - lib/console/event.rb
137
144
  - lib/console/event/failure.rb
138
145
  - lib/console/event/generic.rb
@@ -177,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
184
  - !ruby/object:Gem::Version
178
185
  version: '0'
179
186
  requirements: []
180
- rubygems_version: 3.2.29
187
+ rubygems_version: 3.1.6
181
188
  signing_key:
182
189
  specification_version: 4
183
190
  summary: Beautiful logging for Ruby.
metadata.gz.sig CHANGED
Binary file