console 1.16.2 → 1.17.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: '0538bbfb859ce8e59ced95ef6da6d5bf2b311baa936403b08bd6c70b615117b1'
4
- data.tar.gz: adb22e27bcd5844f916359ba8a972e0f92dad295de72285bdcb8b68cc5410eb7
3
+ metadata.gz: 5a1588810973b2d219accb3bbb33005311b4c214c052c877a601ed8c9cbeaff8
4
+ data.tar.gz: b2cb63cd0c9fa5e136455f5367fd3b8c47896ae04b0f73aa2fe72604af725e2f
5
5
  SHA512:
6
- metadata.gz: b595d1dc0175f426cbcb08e62d9ed4d1fe9043b31b88287666e219676e0f512cc2dc2e4fda117fc50caa75cc577eb080ea342a7db9920ce632b485cffc1d2914
7
- data.tar.gz: 4fe8e5cf7edd75e49e233dba3856d50d5ff6a98aef67a6cd422ad28fa1d48ee77bd0d28426c2d20d2f9a60ce0dc46e5e3f4bbcf68eec83ca61f929b30ca0584f
6
+ metadata.gz: 964c9e0a5362a89d6bbf103d8a16a7f0c29eb5a032fc24d92d5339909bdd76970404640de776d097bd5d1f9b633270d4da67baa3bd2cc69f0cb59ab0564e8217
7
+ data.tar.gz: 4e3cb21047824f715dbc13e98707c6aebc641ebf304c5e11e22c72cf4786102ffeb0690693d23194b45933991bf8de6fc38559f89a0da5a55a10afc2c5df665c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -17,7 +17,7 @@ module Console
17
17
  min_level, max_level = levels.values.minmax
18
18
 
19
19
  klass.instance_exec do
20
- const_set(:LEVELS, levels)
20
+ const_set(:LEVELS, levels.freeze)
21
21
  const_set(:MINIMUM_LEVEL, min_level)
22
22
  const_set(:MAXIMUM_LEVEL, max_level)
23
23
 
@@ -9,6 +9,8 @@ require_relative '../filter'
9
9
  require 'time'
10
10
  require 'json'
11
11
 
12
+ require 'fiber/annotation'
13
+
12
14
  module Console
13
15
  module Serialized
14
16
  class Logger
@@ -44,6 +46,10 @@ module Console
44
46
  record[:subject] = subject
45
47
  end
46
48
 
49
+ if annotation = Fiber.current.annotation
50
+ record[:annotation] = annotation
51
+ end
52
+
47
53
  message = arguments
48
54
 
49
55
  if block_given?
@@ -6,12 +6,14 @@
6
6
 
7
7
  require_relative '../buffer'
8
8
  require_relative '../event'
9
+ require_relative '../clock'
9
10
 
10
11
  require_relative 'text'
11
12
  require_relative 'xterm'
12
13
 
13
14
  require 'json'
14
15
  require 'fiber'
16
+ require 'fiber/annotation'
15
17
 
16
18
  module Console
17
19
  module Terminal
@@ -61,6 +63,9 @@ module Console
61
63
  @terminal[:error] = @terminal.style(:red)
62
64
  @terminal[:fatal] = @terminal[:error]
63
65
 
66
+ @terminal[:annotation] = @terminal.style(:blue)
67
+ @terminal[:value] = @terminal.style(:blue)
68
+
64
69
  self.register_defaults(@terminal)
65
70
  end
66
71
 
@@ -90,18 +95,16 @@ module Console
90
95
 
91
96
  buffer = Buffer.new("#{indent}| ")
92
97
 
93
- if subject
94
- format_subject(severity, prefix, subject, buffer)
98
+ format_subject(severity, prefix, subject, buffer)
99
+
100
+ arguments.each do |argument|
101
+ format_argument(argument, buffer)
95
102
  end
96
103
 
97
104
  if options&.any?
98
105
  format_options(options, buffer)
99
106
  end
100
107
 
101
- arguments.each do |argument|
102
- format_argument(argument, buffer)
103
- end
104
-
105
108
  if block_given?
106
109
  if block.arity.zero?
107
110
  format_argument(yield, buffer)
@@ -126,7 +129,9 @@ module Console
126
129
  when Event::Generic
127
130
  argument.format(output, @terminal, @verbose)
128
131
  else
129
- format_value(argument, output)
132
+ argument.to_s.each_line do |line|
133
+ output.puts line
134
+ end
130
135
  end
131
136
  end
132
137
 
@@ -141,13 +146,23 @@ module Console
141
146
  end
142
147
 
143
148
  def default_suffix(object = nil)
144
- buffer = +" #{@terminal[:logger_suffix]}"
149
+ buffer = +" "
150
+
151
+ if @verbose
152
+ if annotation = Fiber.current.annotation and annotation.size > 0
153
+ buffer << "(#{@terminal[:annotation]}#{annotation})#{@terminal.reset} "
154
+ end
155
+ end
156
+
157
+ buffer << @terminal[:logger_suffix].to_s
145
158
 
146
159
  if object
147
160
  buffer << "[oid=0x#{object.object_id.to_s(16)}] "
148
161
  end
149
162
 
150
163
  buffer << "[ec=0x#{Fiber.current.object_id.to_s(16)}] [pid=#{Process.pid}] [#{::Time.now}]#{@terminal.reset}"
164
+
165
+ return buffer
151
166
  end
152
167
 
153
168
  def format_object_subject(severity, prefix, subject, output)
@@ -178,7 +193,7 @@ module Console
178
193
  string = value.to_s
179
194
 
180
195
  string.each_line do |line|
181
- output.puts "#{line}"
196
+ output.puts "#{@terminal[:value]}#{line}#{@terminal.reset}"
182
197
  end
183
198
  end
184
199
 
@@ -21,7 +21,7 @@ module Console
21
21
  cyan: 6,
22
22
  white: 7,
23
23
  default: 9,
24
- }
24
+ }.freeze
25
25
 
26
26
  ATTRIBUTES = {
27
27
  normal: 0,
@@ -33,7 +33,7 @@ module Console
33
33
  blink: 5,
34
34
  reverse: 7,
35
35
  hidden: 8,
36
- }
36
+ }.freeze
37
37
 
38
38
  def colors?
39
39
  true
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2019-2022, by Samuel Williams.
5
5
 
6
6
  module Console
7
- VERSION = "1.16.2"
7
+ VERSION = "1.17.0"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.2
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -43,7 +43,7 @@ cert_chain:
43
43
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
44
44
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
45
45
  -----END CERTIFICATE-----
46
- date: 2022-10-12 00:00:00.000000000 Z
46
+ date: 2023-06-05 00:00:00.000000000 Z
47
47
  dependencies:
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: fiber-local
@@ -59,6 +59,20 @@ dependencies:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: fiber-annotation
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ type: :runtime
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
62
76
  - !ruby/object:Gem::Dependency
63
77
  name: bake
64
78
  requirement: !ruby/object:Gem::Requirement
@@ -192,14 +206,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
206
  requirements:
193
207
  - - ">="
194
208
  - !ruby/object:Gem::Version
195
- version: '2.7'
209
+ version: 2.7.3
196
210
  required_rubygems_version: !ruby/object:Gem::Requirement
197
211
  requirements:
198
212
  - - ">="
199
213
  - !ruby/object:Gem::Version
200
214
  version: '0'
201
215
  requirements: []
202
- rubygems_version: 3.3.7
216
+ rubygems_version: 3.4.7
203
217
  signing_key:
204
218
  specification_version: 4
205
219
  summary: Beautiful logging for Ruby.
metadata.gz.sig CHANGED
Binary file