console 1.16.2 → 1.17.1

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: ec8cced656faf79ff199d9ddc458a08b8e0591076ff7a4f8358f15a8d1f4bd31
4
+ data.tar.gz: d6e73fbbc6ae63365407df0816fc78749963a504a8a201f06c2ddc8f0685a886
5
5
  SHA512:
6
- metadata.gz: b595d1dc0175f426cbcb08e62d9ed4d1fe9043b31b88287666e219676e0f512cc2dc2e4fda117fc50caa75cc577eb080ea342a7db9920ce632b485cffc1d2914
7
- data.tar.gz: 4fe8e5cf7edd75e49e233dba3856d50d5ff6a98aef67a6cd422ad28fa1d48ee77bd0d28426c2d20d2f9a60ce0dc46e5e3f4bbcf68eec83ca61f929b30ca0584f
6
+ metadata.gz: 4550d9eaea0351ab08d1e238d8ea9a854265c10842b7e13be5c139d744694f8cf18446a0650590a5f3413d56c1cb10a421cb8633c197f15a66d0b82cc8090f6f
7
+ data.tar.gz: 80e04be768476261d778a30eeb9d03e1d7f40eaea138e63f7b5dc5034e75ecf029769d2e879f549e424a57371fdf3def5b457af15cd3e423f6c3dd3dd019c3b9
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.reset
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]}"
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.1"
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.1
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-06 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