e621stream 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +35 -0
- data/lib/e621stream/client/options.rb +20 -0
- data/lib/e621stream/client.rb +211 -0
- data/lib/e621stream/close_codes.rb +23 -0
- data/lib/e621stream/event.rb +24 -0
- data/lib/e621stream/events.rb +29 -0
- data/lib/e621stream/stream_error.rb +18 -0
- data/lib/e621stream/version.rb +5 -0
- data/lib/e621stream.rb +18 -0
- data/sorbet/config +6 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/minitest.rbi +120 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
- data/sorbet/rbi/gems/async-http@0.105.0.rbi +1649 -0
- data/sorbet/rbi/gems/async-pool@0.12.0.rbi +219 -0
- data/sorbet/rbi/gems/async-websocket@0.30.2.rbi +271 -0
- data/sorbet/rbi/gems/async@2.46.0.rbi +2193 -0
- data/sorbet/rbi/gems/benchmark@0.5.0.rbi +495 -0
- data/sorbet/rbi/gems/console@1.38.0.rbi +1552 -0
- data/sorbet/rbi/gems/erb@6.0.7.rbi +1581 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +153 -0
- data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +62 -0
- data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +36 -0
- data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +43 -0
- data/sorbet/rbi/gems/io-console@0.9.5.rbi +9 -0
- data/sorbet/rbi/gems/io-endpoint@0.19.0.rbi +1079 -0
- data/sorbet/rbi/gems/io-event@1.22.3.rbi +971 -0
- data/sorbet/rbi/gems/io-stream@0.14.0.rbi +805 -0
- data/sorbet/rbi/gems/json@3.1.0.rbi +1929 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.6.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
- data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
- data/sorbet/rbi/gems/minitest@5.27.0.rbi +1499 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
- data/sorbet/rbi/gems/openssl@4.0.2.rbi +4366 -0
- data/sorbet/rbi/gems/parallel@2.3.0.rbi +332 -0
- data/sorbet/rbi/gems/parser@3.3.13.0.rbi +5146 -0
- data/sorbet/rbi/gems/pp@0.6.4.rbi +373 -0
- data/sorbet/rbi/gems/prettyprint@0.2.1.rbi +476 -0
- data/sorbet/rbi/gems/prism@1.9.0.rbi +42213 -0
- data/sorbet/rbi/gems/protocol-hpack@1.5.1.rbi +418 -0
- data/sorbet/rbi/gems/protocol-http1@0.41.1.rbi +894 -0
- data/sorbet/rbi/gems/protocol-http2@0.29.2.rbi +2277 -0
- data/sorbet/rbi/gems/protocol-http@0.72.1.rbi +3801 -0
- data/sorbet/rbi/gems/protocol-rack@0.23.0.rbi +9 -0
- data/sorbet/rbi/gems/protocol-url@0.19.0.rbi +9 -0
- data/sorbet/rbi/gems/protocol-websocket@0.21.3.rbi +1087 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +169 -0
- data/sorbet/rbi/gems/rack@3.2.8.rbi +9 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
- data/sorbet/rbi/gems/rake@13.4.2.rbi +3127 -0
- data/sorbet/rbi/gems/rbi@0.5.0.rbi +5875 -0
- data/sorbet/rbi/gems/rbs@4.2.0.rbi +7133 -0
- data/sorbet/rbi/gems/rdoc@8.1.0.rbi +9 -0
- data/sorbet/rbi/gems/regexp_parser@2.13.1.rbi +3500 -0
- data/sorbet/rbi/gems/reline@0.7.0.rbi +2449 -0
- data/sorbet/rbi/gems/require-hooks@0.5.1.rbi +152 -0
- data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
- data/sorbet/rbi/gems/rubocop-ast@1.51.0.rbi +7230 -0
- data/sorbet/rbi/gems/rubocop-rake@0.7.1.rbi +314 -0
- data/sorbet/rbi/gems/rubocop@1.92.2.rbi +69094 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
- data/sorbet/rbi/gems/rubydex@0.4.4.rbi +1620 -0
- data/sorbet/rbi/gems/spoom@1.8.13.rbi +7380 -0
- data/sorbet/rbi/gems/tapioca@0.20.0.rbi +3752 -0
- data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
- data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
- data/sorbet/rbi/gems/unicode-display_width@3.3.0.rbi +130 -0
- data/sorbet/rbi/gems/unicode-emoji@4.3.0.rbi +254 -0
- data/sorbet/rbi/gems/zeitwerk@2.8.3.rbi +1178 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +175 -0
|
@@ -0,0 +1,1552 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
# DO NOT EDIT MANUALLY
|
|
4
|
+
# This is an autogenerated file for types exported from the `console` gem.
|
|
5
|
+
# Please instead update this file by running `bin/tapioca gem console`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# @namespace
|
|
9
|
+
# Released under the MIT License.
|
|
10
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
|
11
|
+
# Released under the MIT License.
|
|
12
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
|
13
|
+
# Copyright, 2026, by William T. Nelson.
|
|
14
|
+
# Released under the MIT License.
|
|
15
|
+
# Copyright, 2019-2025, by Samuel Williams.
|
|
16
|
+
# Released under the MIT License.
|
|
17
|
+
# Copyright, 2019-2025, by Samuel Williams.
|
|
18
|
+
# Copyright, 2019, by Bryan Powell.
|
|
19
|
+
# Copyright, 2020, by Michael Adams.
|
|
20
|
+
# Copyright, 2021, by Robert Schulze.
|
|
21
|
+
# Copyright, 2026, by Copilot.
|
|
22
|
+
# Released under the MIT License.
|
|
23
|
+
# Copyright, 2023-2025, by Samuel Williams.
|
|
24
|
+
# Released under the MIT License.
|
|
25
|
+
# Copyright, 2022-2025, by Samuel Williams.
|
|
26
|
+
# Released under the MIT License.
|
|
27
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
|
28
|
+
# Released under the MIT License.
|
|
29
|
+
# Copyright, 2024-2025, by Samuel Williams.
|
|
30
|
+
# Released under the MIT License.
|
|
31
|
+
# Copyright, 2020-2025, by Samuel Williams.
|
|
32
|
+
# Released under the MIT License.
|
|
33
|
+
# Copyright, 2019-2026, by Samuel Williams.
|
|
34
|
+
#
|
|
35
|
+
# pkg:gem/console#lib/console/version.rb:6
|
|
36
|
+
module Console
|
|
37
|
+
extend ::Console::Interface
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# A simple clock utility for tracking and formatting time.
|
|
41
|
+
#
|
|
42
|
+
# pkg:gem/console#lib/console/clock.rb:9
|
|
43
|
+
module Console::Clock
|
|
44
|
+
class << self
|
|
45
|
+
# Format a duration in seconds as a human readable string.
|
|
46
|
+
#
|
|
47
|
+
# @parameter duration [Numeric] The duration in seconds.
|
|
48
|
+
# @returns [String] The formatted duration.
|
|
49
|
+
#
|
|
50
|
+
# pkg:gem/console#lib/console/clock.rb:14
|
|
51
|
+
def formatted_duration(duration); end
|
|
52
|
+
|
|
53
|
+
# @returns [Time] The current monotonic time.
|
|
54
|
+
#
|
|
55
|
+
# pkg:gem/console#lib/console/clock.rb:44
|
|
56
|
+
def now; end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Represents a configuration for the traces library.
|
|
61
|
+
#
|
|
62
|
+
# pkg:gem/console#lib/console/config.rb:14
|
|
63
|
+
class Console::Config
|
|
64
|
+
# Set the default log level based on `$DEBUG` and `$VERBOSE`.
|
|
65
|
+
# You can also specify CONSOLE_LEVEL=debug or CONSOLE_LEVEL=info in environment.
|
|
66
|
+
# https://mislav.net/2011/06/ruby-verbose-mode/ has more details about how it all fits together.
|
|
67
|
+
#
|
|
68
|
+
# @parameter env [Hash] The environment to read the log level from.
|
|
69
|
+
# @returns [Integer | Symbol] The default log level.
|
|
70
|
+
#
|
|
71
|
+
# pkg:gem/console#lib/console/config.rb:42
|
|
72
|
+
def log_level(env = T.unsafe(nil)); end
|
|
73
|
+
|
|
74
|
+
# Create a logger with the given output and options.
|
|
75
|
+
#
|
|
76
|
+
# @parameter output [IO] The output to write log messages to.
|
|
77
|
+
# @parameter env [Hash] The environment to read configuration from.
|
|
78
|
+
# @parameter options [Hash] Additional options to pass to the logger.
|
|
79
|
+
# @returns [Logger] The created logger.
|
|
80
|
+
#
|
|
81
|
+
# pkg:gem/console#lib/console/config.rb:75
|
|
82
|
+
def make_logger(io = T.unsafe(nil), env = T.unsafe(nil), **options); end
|
|
83
|
+
|
|
84
|
+
# Create an output with the given output and options.
|
|
85
|
+
#
|
|
86
|
+
# @parameter output [IO] The output to write log messages to.
|
|
87
|
+
# @parameter env [Hash] The environment to read configuration from.
|
|
88
|
+
# @parameter options [Hash] Additional options to pass to the output.
|
|
89
|
+
# @returns [Output] The created output.
|
|
90
|
+
#
|
|
91
|
+
# pkg:gem/console#lib/console/config.rb:57
|
|
92
|
+
def make_output(io = T.unsafe(nil), env = T.unsafe(nil), **options); end
|
|
93
|
+
|
|
94
|
+
# Create a resolver with the given logger.
|
|
95
|
+
#
|
|
96
|
+
# @parameter logger [Logger] The logger to set the log levels on.
|
|
97
|
+
# @returns [Resolver | Nil] The created resolver.
|
|
98
|
+
#
|
|
99
|
+
# pkg:gem/console#lib/console/config.rb:65
|
|
100
|
+
def make_resolver(logger); end
|
|
101
|
+
|
|
102
|
+
# Controls verbose output using `$VERBOSE`.
|
|
103
|
+
#
|
|
104
|
+
# pkg:gem/console#lib/console/config.rb:47
|
|
105
|
+
def verbose?(env = T.unsafe(nil)); end
|
|
106
|
+
|
|
107
|
+
class << self
|
|
108
|
+
# Load the default configuration.
|
|
109
|
+
# @returns [Config] The default configuration.
|
|
110
|
+
#
|
|
111
|
+
# pkg:gem/console#lib/console/config.rb:32
|
|
112
|
+
def default; end
|
|
113
|
+
|
|
114
|
+
# Load the configuration from the given path.
|
|
115
|
+
# @parameter path [String] The path to the configuration file.
|
|
116
|
+
# @returns [Config] The loaded configuration.
|
|
117
|
+
#
|
|
118
|
+
# pkg:gem/console#lib/console/config.rb:20
|
|
119
|
+
def load(path); end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Load the default configuration.
|
|
124
|
+
#
|
|
125
|
+
# pkg:gem/console#lib/console/config.rb:94
|
|
126
|
+
Console::Config::DEFAULT = T.let(T.unsafe(nil), Console::Config)
|
|
127
|
+
|
|
128
|
+
# pkg:gem/console#lib/console/config.rb:15
|
|
129
|
+
Console::Config::PATH = T.let(T.unsafe(nil), String)
|
|
130
|
+
|
|
131
|
+
# Structured event logging.
|
|
132
|
+
#
|
|
133
|
+
# pkg:gem/console#lib/console/event/generic.rb:7
|
|
134
|
+
module Console::Event; end
|
|
135
|
+
|
|
136
|
+
# Represents a failure of some kind, usually with an attached exception.
|
|
137
|
+
#
|
|
138
|
+
# ```ruby
|
|
139
|
+
# begin
|
|
140
|
+
# raise "Something went wrong!"
|
|
141
|
+
# rescue => exception
|
|
142
|
+
# Console::Event::Failure.log("Something went wrong!", exception)
|
|
143
|
+
# end
|
|
144
|
+
# ```
|
|
145
|
+
#
|
|
146
|
+
# Generally, you should use the {Console.error} method to log failures, as it will automatically create a failure event for you.
|
|
147
|
+
#
|
|
148
|
+
# pkg:gem/console#lib/console/event/failure.rb:23
|
|
149
|
+
class Console::Event::Failure < ::Console::Event::Generic
|
|
150
|
+
# Create a new failure event for the given exception.
|
|
151
|
+
#
|
|
152
|
+
# @parameter exception [Exception] The exception to log.
|
|
153
|
+
# @parameter root [String] The root directory of the project.
|
|
154
|
+
#
|
|
155
|
+
# pkg:gem/console#lib/console/event/failure.rb:56
|
|
156
|
+
def initialize(exception, root = T.unsafe(nil)); end
|
|
157
|
+
|
|
158
|
+
# Log the failure event.
|
|
159
|
+
#
|
|
160
|
+
# @parameter arguments [Array] The arguments to log.
|
|
161
|
+
# @parameter options [Hash] Additional options to pass to the logger output.
|
|
162
|
+
#
|
|
163
|
+
# pkg:gem/console#lib/console/event/failure.rb:76
|
|
164
|
+
def emit(*arguments, **options); end
|
|
165
|
+
|
|
166
|
+
# @attribute [Exception] The exception which caused the failure.
|
|
167
|
+
#
|
|
168
|
+
# pkg:gem/console#lib/console/event/failure.rb:50
|
|
169
|
+
def exception; end
|
|
170
|
+
|
|
171
|
+
# Convert the failure event to a hash.
|
|
172
|
+
#
|
|
173
|
+
# @returns [Hash] The hash representation of the failure event.
|
|
174
|
+
#
|
|
175
|
+
# pkg:gem/console#lib/console/event/failure.rb:64
|
|
176
|
+
def to_hash; end
|
|
177
|
+
|
|
178
|
+
private
|
|
179
|
+
|
|
180
|
+
# pkg:gem/console#lib/console/event/failure.rb:84
|
|
181
|
+
def extract(exception, hash); end
|
|
182
|
+
|
|
183
|
+
class << self
|
|
184
|
+
# For the purpose of efficiently formatting backtraces, we need to know the root directory of the project.
|
|
185
|
+
#
|
|
186
|
+
# @returns [String | Nil] The root directory of the project, or nil if it could not be determined.
|
|
187
|
+
#
|
|
188
|
+
# pkg:gem/console#lib/console/event/failure.rb:27
|
|
189
|
+
def default_root; end
|
|
190
|
+
|
|
191
|
+
# Create a new failure event for the given exception.
|
|
192
|
+
#
|
|
193
|
+
# @parameter exception [Exception] The exception to log.
|
|
194
|
+
#
|
|
195
|
+
# pkg:gem/console#lib/console/event/failure.rb:36
|
|
196
|
+
def for(exception); end
|
|
197
|
+
|
|
198
|
+
# Log a failure event with the given exception.
|
|
199
|
+
#
|
|
200
|
+
# @parameter subject [String] The subject of the log message.
|
|
201
|
+
# @parameter exception [Exception] The exception to log.
|
|
202
|
+
# @parameter options [Hash] Additional options pass to the logger output.
|
|
203
|
+
#
|
|
204
|
+
# pkg:gem/console#lib/console/event/failure.rb:45
|
|
205
|
+
def log(subject, exception, **options); end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# A generic event which can be used to represent structured data.
|
|
210
|
+
#
|
|
211
|
+
# pkg:gem/console#lib/console/event/generic.rb:9
|
|
212
|
+
class Console::Event::Generic
|
|
213
|
+
# Convert the event to a hash suitable for JSON serialization.
|
|
214
|
+
#
|
|
215
|
+
# @returns [Hash] The hash representation of the event.
|
|
216
|
+
#
|
|
217
|
+
# pkg:gem/console#lib/console/event/generic.rb:20
|
|
218
|
+
def as_json(*, **, &); end
|
|
219
|
+
|
|
220
|
+
# Log the event using the given output interface.
|
|
221
|
+
#
|
|
222
|
+
# @parameter arguments [Array] The arguments to log.
|
|
223
|
+
# @parameter options [Hash] Additional options to pass to the logger output.
|
|
224
|
+
#
|
|
225
|
+
# pkg:gem/console#lib/console/event/generic.rb:42
|
|
226
|
+
def emit(*arguments, **options); end
|
|
227
|
+
|
|
228
|
+
# Convert the event to a hash suitable for JSON serialization.
|
|
229
|
+
#
|
|
230
|
+
# @returns [Hash] The hash representation of the event.
|
|
231
|
+
#
|
|
232
|
+
# pkg:gem/console#lib/console/event/generic.rb:13
|
|
233
|
+
def to_hash; end
|
|
234
|
+
|
|
235
|
+
# Serialize the event to JSON.
|
|
236
|
+
#
|
|
237
|
+
# @returns [String] The JSON representation of the event.
|
|
238
|
+
#
|
|
239
|
+
# pkg:gem/console#lib/console/event/generic.rb:27
|
|
240
|
+
def to_json(*, **, &); end
|
|
241
|
+
|
|
242
|
+
# Convert the event to a string (JSON).
|
|
243
|
+
#
|
|
244
|
+
# @returns [String] The string representation of the event.
|
|
245
|
+
#
|
|
246
|
+
# pkg:gem/console#lib/console/event/generic.rb:34
|
|
247
|
+
def to_s; end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Represents a child process spawn event.
|
|
251
|
+
#
|
|
252
|
+
# ```ruby
|
|
253
|
+
# Console.info(self, **Console::Event::Spawn.for("ls", "-l"))
|
|
254
|
+
#
|
|
255
|
+
# event = Console::Event::Spawn.for("ls", "-l")
|
|
256
|
+
# event.status = Process.wait
|
|
257
|
+
# ```
|
|
258
|
+
#
|
|
259
|
+
# pkg:gem/console#lib/console/event/spawn.rb:19
|
|
260
|
+
class Console::Event::Spawn < ::Console::Event::Generic
|
|
261
|
+
# Create a new spawn event.
|
|
262
|
+
#
|
|
263
|
+
# @parameter environment [Hash] The environment to use when running the command.
|
|
264
|
+
# @parameter arguments [Array] The arguments used for command execution.
|
|
265
|
+
# @parameter options [Hash] The options to pass to the command, similar to how you would pass them to `Kernel.system` or `Process.spawn`.
|
|
266
|
+
#
|
|
267
|
+
# pkg:gem/console#lib/console/event/spawn.rb:40
|
|
268
|
+
def initialize(environment, arguments, options); end
|
|
269
|
+
|
|
270
|
+
# Calculate the duration of the command, if it has completed.
|
|
271
|
+
#
|
|
272
|
+
# @returns [Numeric] The duration of the command.
|
|
273
|
+
#
|
|
274
|
+
# pkg:gem/console#lib/console/event/spawn.rb:71
|
|
275
|
+
def duration; end
|
|
276
|
+
|
|
277
|
+
# Log the spawn event.
|
|
278
|
+
#
|
|
279
|
+
# @parameter arguments [Array] The arguments to log.
|
|
280
|
+
# @parameter options [Hash] Additional options to pass to the logger output.
|
|
281
|
+
#
|
|
282
|
+
# pkg:gem/console#lib/console/event/spawn.rb:99
|
|
283
|
+
def emit(*arguments, **options); end
|
|
284
|
+
|
|
285
|
+
# @attribute [Numeric] The end time of the command.
|
|
286
|
+
#
|
|
287
|
+
# pkg:gem/console#lib/console/event/spawn.rb:55
|
|
288
|
+
def end_time; end
|
|
289
|
+
|
|
290
|
+
# @attribute [Numeric] The start time of the command.
|
|
291
|
+
#
|
|
292
|
+
# pkg:gem/console#lib/console/event/spawn.rb:52
|
|
293
|
+
def start_time; end
|
|
294
|
+
|
|
295
|
+
# @attribute [Process::Status] The status of the command, if it has completed.
|
|
296
|
+
#
|
|
297
|
+
# pkg:gem/console#lib/console/event/spawn.rb:58
|
|
298
|
+
def status; end
|
|
299
|
+
|
|
300
|
+
# Set the status of the command, and record the end time.
|
|
301
|
+
#
|
|
302
|
+
# @parameter status [Process::Status] The status of the command.
|
|
303
|
+
#
|
|
304
|
+
# pkg:gem/console#lib/console/event/spawn.rb:63
|
|
305
|
+
def status=(status); end
|
|
306
|
+
|
|
307
|
+
# Convert the spawn event to a hash suitable for JSON serialization.
|
|
308
|
+
#
|
|
309
|
+
# @returns [Hash] The hash representation of the spawn event.
|
|
310
|
+
#
|
|
311
|
+
# pkg:gem/console#lib/console/event/spawn.rb:80
|
|
312
|
+
def to_hash; end
|
|
313
|
+
|
|
314
|
+
private
|
|
315
|
+
|
|
316
|
+
# pkg:gem/console#lib/console/event/spawn.rb:106
|
|
317
|
+
def now; end
|
|
318
|
+
|
|
319
|
+
class << self
|
|
320
|
+
# Create a new spawn event.
|
|
321
|
+
#
|
|
322
|
+
# @parameter arguments [Array] The arguments to the command, similar to how you would pass them to `Kernel.system` or `Process.spawn`.
|
|
323
|
+
# @parameter options [Hash] The options to pass to the command, similar to how you would pass them to `Kernel.system` or `Process.spawn`.
|
|
324
|
+
# @returns [Spawn] The new spawn event representing the command.
|
|
325
|
+
#
|
|
326
|
+
# pkg:gem/console#lib/console/event/spawn.rb:25
|
|
327
|
+
def for(*arguments, **options); end
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# A log filter which can be used to filter log messages based on severity, subject, and other criteria.
|
|
332
|
+
#
|
|
333
|
+
# pkg:gem/console#lib/console/filter.rb:14
|
|
334
|
+
class Console::Filter
|
|
335
|
+
# Create a new log filter.
|
|
336
|
+
#
|
|
337
|
+
# @parameter output [Console::Output] The output destination.
|
|
338
|
+
# @parameter verbose [Boolean] Enable verbose output.
|
|
339
|
+
# @parameter level [Integer] The log level.
|
|
340
|
+
# @parameter options [Hash] Additional options.
|
|
341
|
+
#
|
|
342
|
+
# pkg:gem/console#lib/console/filter.rb:78
|
|
343
|
+
def initialize(output, verbose: T.unsafe(nil), level: T.unsafe(nil), **options); end
|
|
344
|
+
|
|
345
|
+
# Enable all logging.
|
|
346
|
+
#
|
|
347
|
+
# pkg:gem/console#lib/console/filter.rb:148
|
|
348
|
+
def all!; end
|
|
349
|
+
|
|
350
|
+
# Log a message with the given severity.
|
|
351
|
+
#
|
|
352
|
+
# If the severity is not defined in this filter's LEVELS (e.g., when chaining
|
|
353
|
+
# filters with different severity levels), the message is passed through to the
|
|
354
|
+
# output without filtering. This allows custom filters to be composed together.
|
|
355
|
+
#
|
|
356
|
+
# @parameter subject [Object] The subject of the log message.
|
|
357
|
+
# @parameter arguments [Array] The arguments to log.
|
|
358
|
+
# @parameter options [Hash] Additional options to pass to the output.
|
|
359
|
+
# @parameter block [Proc] A block passed to the output.
|
|
360
|
+
# @returns [Nil] Always returns nil.
|
|
361
|
+
#
|
|
362
|
+
# pkg:gem/console#lib/console/filter.rb:223
|
|
363
|
+
def call(subject, *arguments, **options, &block); end
|
|
364
|
+
|
|
365
|
+
# Clear any specific filters for the given class.
|
|
366
|
+
#
|
|
367
|
+
# @parameter subject [Module] The class to disable.
|
|
368
|
+
#
|
|
369
|
+
# pkg:gem/console#lib/console/filter.rb:204
|
|
370
|
+
def clear(subject); end
|
|
371
|
+
|
|
372
|
+
# Disable logging for the given class.
|
|
373
|
+
#
|
|
374
|
+
# @parameter name [Module] The class to disable.
|
|
375
|
+
#
|
|
376
|
+
# pkg:gem/console#lib/console/filter.rb:196
|
|
377
|
+
def disable(subject); end
|
|
378
|
+
|
|
379
|
+
# Enable specific log level for the given class.
|
|
380
|
+
#
|
|
381
|
+
# @parameter name [Module] The class to enable.
|
|
382
|
+
#
|
|
383
|
+
# pkg:gem/console#lib/console/filter.rb:188
|
|
384
|
+
def enable(subject, level = T.unsafe(nil)); end
|
|
385
|
+
|
|
386
|
+
# Whether logging is enabled for the given subject and log level.
|
|
387
|
+
#
|
|
388
|
+
# You can enable and disable logging for classes. This function checks if logging for a given subject is enabled.
|
|
389
|
+
#
|
|
390
|
+
# @parameter subject [Module | Object] The subject to check.
|
|
391
|
+
# @parameter level [Integer] The log level.
|
|
392
|
+
# @returns [Boolean] Whether logging is enabled.
|
|
393
|
+
#
|
|
394
|
+
# pkg:gem/console#lib/console/filter.rb:173
|
|
395
|
+
def enabled?(subject, level = T.unsafe(nil)); end
|
|
396
|
+
|
|
397
|
+
# Filter log messages based on the subject and log level.
|
|
398
|
+
#
|
|
399
|
+
# You must provide the subject's class, not an instance of the class.
|
|
400
|
+
#
|
|
401
|
+
# @parameter subject [Module] The subject to filter.
|
|
402
|
+
# @parameter level [Integer] The log level.
|
|
403
|
+
#
|
|
404
|
+
# pkg:gem/console#lib/console/filter.rb:158
|
|
405
|
+
def filter(subject, level); end
|
|
406
|
+
|
|
407
|
+
# @attribute [Integer] The current log level.
|
|
408
|
+
#
|
|
409
|
+
# pkg:gem/console#lib/console/filter.rb:115
|
|
410
|
+
def level; end
|
|
411
|
+
|
|
412
|
+
# Set the log level.
|
|
413
|
+
#
|
|
414
|
+
# @parameter level [Integer | Symbol] The log level.
|
|
415
|
+
#
|
|
416
|
+
# pkg:gem/console#lib/console/filter.rb:126
|
|
417
|
+
def level=(level); end
|
|
418
|
+
|
|
419
|
+
# Disable all logging.
|
|
420
|
+
#
|
|
421
|
+
# pkg:gem/console#lib/console/filter.rb:143
|
|
422
|
+
def off!; end
|
|
423
|
+
|
|
424
|
+
# @attribute [Hash] Additional options.
|
|
425
|
+
#
|
|
426
|
+
# pkg:gem/console#lib/console/filter.rb:121
|
|
427
|
+
def options; end
|
|
428
|
+
|
|
429
|
+
# @attribute [Hash] Additional options.
|
|
430
|
+
#
|
|
431
|
+
# pkg:gem/console#lib/console/filter.rb:121
|
|
432
|
+
def options=(_arg0); end
|
|
433
|
+
|
|
434
|
+
# @attribute [Console::Output] The output destination.
|
|
435
|
+
#
|
|
436
|
+
# pkg:gem/console#lib/console/filter.rb:109
|
|
437
|
+
def output; end
|
|
438
|
+
|
|
439
|
+
# @attribute [Console::Output] The output destination.
|
|
440
|
+
#
|
|
441
|
+
# pkg:gem/console#lib/console/filter.rb:109
|
|
442
|
+
def output=(_arg0); end
|
|
443
|
+
|
|
444
|
+
# @attribute [Hash(Module, Integer)] The log levels for specific subject (classes).
|
|
445
|
+
#
|
|
446
|
+
# pkg:gem/console#lib/console/filter.rb:118
|
|
447
|
+
def subjects; end
|
|
448
|
+
|
|
449
|
+
# @attribute [Boolean] Whether to enable verbose output.
|
|
450
|
+
#
|
|
451
|
+
# pkg:gem/console#lib/console/filter.rb:112
|
|
452
|
+
def verbose; end
|
|
453
|
+
|
|
454
|
+
# Set verbose output (enable by default with no arguments).
|
|
455
|
+
#
|
|
456
|
+
# @parameter value [Boolean] Enable or disable verbose output.
|
|
457
|
+
#
|
|
458
|
+
# pkg:gem/console#lib/console/filter.rb:137
|
|
459
|
+
def verbose!(value = T.unsafe(nil)); end
|
|
460
|
+
|
|
461
|
+
# Create a new log filter with the given options, from an existing log filter.
|
|
462
|
+
#
|
|
463
|
+
# @parameter level [Integer] The log level.
|
|
464
|
+
# @parameter verbose [Boolean] Enable verbose output.
|
|
465
|
+
# @parameter options [Hash] Additional options.
|
|
466
|
+
# @returns [Console::Filter] The new log filter.
|
|
467
|
+
#
|
|
468
|
+
# pkg:gem/console#lib/console/filter.rb:100
|
|
469
|
+
def with(level: T.unsafe(nil), verbose: T.unsafe(nil), **options); end
|
|
470
|
+
|
|
471
|
+
class << self
|
|
472
|
+
# Create a new log filter with specific log levels.
|
|
473
|
+
#
|
|
474
|
+
# ```ruby
|
|
475
|
+
# class MyLogger < Console::Filter[debug: 0, okay: 1, bad: 2, terrible: 3]
|
|
476
|
+
# ```
|
|
477
|
+
#
|
|
478
|
+
# @parameter levels [Hash(Symbol, Integer)] A hash of log levels.
|
|
479
|
+
#
|
|
480
|
+
# pkg:gem/console#lib/console/filter.rb:35
|
|
481
|
+
def [](**levels); end
|
|
482
|
+
|
|
483
|
+
# Define a method.
|
|
484
|
+
# Define a method which can be shared between ractors.
|
|
485
|
+
#
|
|
486
|
+
# pkg:gem/console#lib/console/filter.rb:17
|
|
487
|
+
def define_immutable_method(name, &block); end
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
# @namespace
|
|
492
|
+
#
|
|
493
|
+
# pkg:gem/console#lib/console/format/safe.rb:10
|
|
494
|
+
module Console::Format
|
|
495
|
+
class << self
|
|
496
|
+
# A safe format for converting objects to strings.
|
|
497
|
+
#
|
|
498
|
+
# @returns [Console::Format::Safe]
|
|
499
|
+
#
|
|
500
|
+
# pkg:gem/console#lib/console/format.rb:14
|
|
501
|
+
def default; end
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
# A safe format for converting objects to strings.
|
|
506
|
+
#
|
|
507
|
+
# Handles issues like circular references, encoding errors, excessive nesting depth, and excessive output size.
|
|
508
|
+
#
|
|
509
|
+
# pkg:gem/console#lib/console/format/safe.rb:14
|
|
510
|
+
class Console::Format::Safe
|
|
511
|
+
# Create a new safe format.
|
|
512
|
+
#
|
|
513
|
+
# @parameter format [JSON] The format to use for serialization.
|
|
514
|
+
# @parameter depth_limit [Integer] The maximum depth to recurse into objects (the JSON `max_nesting`).
|
|
515
|
+
# @parameter size_limit [Integer | Nil] The maximum byte size of the serialized output, or `nil` to disable size limiting. Limits below {TRUNCATED} (the minimal marker) cannot be honoured.
|
|
516
|
+
# @parameter encoding [Encoding] The encoding to use for strings.
|
|
517
|
+
# @parameter limit [Integer | Nil] Deprecated alias for `depth_limit`.
|
|
518
|
+
#
|
|
519
|
+
# pkg:gem/console#lib/console/format/safe.rb:25
|
|
520
|
+
def initialize(format: T.unsafe(nil), depth_limit: T.unsafe(nil), size_limit: T.unsafe(nil), encoding: T.unsafe(nil), limit: T.unsafe(nil)); end
|
|
521
|
+
|
|
522
|
+
# @attribute [Integer] The maximum depth to recurse into objects.
|
|
523
|
+
#
|
|
524
|
+
# pkg:gem/console#lib/console/format/safe.rb:38
|
|
525
|
+
def depth_limit; end
|
|
526
|
+
|
|
527
|
+
# Dump the given object to a string.
|
|
528
|
+
#
|
|
529
|
+
# The common case is a single fast serialization. If that fails (e.g. circular
|
|
530
|
+
# references, excessive nesting, or encoding errors) or its output exceeds
|
|
531
|
+
# {size_limit}, it falls back to {safe_dump}, which rebuilds the record
|
|
532
|
+
# field-by-field within the limit.
|
|
533
|
+
#
|
|
534
|
+
# @parameter object [Object] The object to dump.
|
|
535
|
+
# @returns [String] The dumped object.
|
|
536
|
+
#
|
|
537
|
+
# pkg:gem/console#lib/console/format/safe.rb:52
|
|
538
|
+
def dump(object); end
|
|
539
|
+
|
|
540
|
+
# @attribute [Integer | Nil] The maximum byte size of the serialized output.
|
|
541
|
+
#
|
|
542
|
+
# pkg:gem/console#lib/console/format/safe.rb:41
|
|
543
|
+
def size_limit; end
|
|
544
|
+
|
|
545
|
+
private
|
|
546
|
+
|
|
547
|
+
# Create a new hash with identity comparison.
|
|
548
|
+
#
|
|
549
|
+
# pkg:gem/console#lib/console/format/safe.rb:227
|
|
550
|
+
def default_objects; end
|
|
551
|
+
|
|
552
|
+
# Serialize a single top-level `"key":value` pair, safely handling values that
|
|
553
|
+
# cannot be serialized directly.
|
|
554
|
+
#
|
|
555
|
+
# @parameter key [Object] The field key.
|
|
556
|
+
# @parameter value [Object] The field value.
|
|
557
|
+
# @returns [Array(String, Exception | Nil)] The `"key":value` fragment and the error, if recovery was needed.
|
|
558
|
+
#
|
|
559
|
+
# pkg:gem/console#lib/console/format/safe.rb:149
|
|
560
|
+
def dump_pair(key, value); end
|
|
561
|
+
|
|
562
|
+
# Serialize a string as a JSON string, encoding it safely first.
|
|
563
|
+
#
|
|
564
|
+
# @parameter value [String] The string to serialize.
|
|
565
|
+
# @returns [String] The serialized (quoted) string.
|
|
566
|
+
#
|
|
567
|
+
# pkg:gem/console#lib/console/format/safe.rb:169
|
|
568
|
+
def dump_string(value); end
|
|
569
|
+
|
|
570
|
+
# Serialize a single value, falling back to a safe representation on failure.
|
|
571
|
+
#
|
|
572
|
+
# @parameter value [Object] The value to serialize.
|
|
573
|
+
# @returns [Array(String, Exception | Nil)] The serialized value and the error, if recovery was needed.
|
|
574
|
+
#
|
|
575
|
+
# pkg:gem/console#lib/console/format/safe.rb:159
|
|
576
|
+
def dump_value(value); end
|
|
577
|
+
|
|
578
|
+
# Build a safe, primitive representation of an error for inclusion as an `"error"` field.
|
|
579
|
+
#
|
|
580
|
+
# @parameter error [Exception] The error that occurred while dumping the object.
|
|
581
|
+
# @returns [Hash] The error details (class, message, filtered backtrace).
|
|
582
|
+
#
|
|
583
|
+
# pkg:gem/console#lib/console/format/safe.rb:218
|
|
584
|
+
def error_info(error); end
|
|
585
|
+
|
|
586
|
+
# Filter the backtrace to remove duplicate frames and reduce verbosity.
|
|
587
|
+
#
|
|
588
|
+
# @parameter error [Exception] The exception to filter.
|
|
589
|
+
# @returns [Array(String)] The filtered backtrace.
|
|
590
|
+
#
|
|
591
|
+
# pkg:gem/console#lib/console/format/safe.rb:177
|
|
592
|
+
def filter_backtrace(error); end
|
|
593
|
+
|
|
594
|
+
# Produce a safe, size-limited serialization of the given object. This is the
|
|
595
|
+
# fallback path, used both when direct serialization fails (an exception) and
|
|
596
|
+
# when its output exceeds {size_limit}.
|
|
597
|
+
#
|
|
598
|
+
# Each top-level value is serialized independently and defensively, so a single
|
|
599
|
+
# un-serializable or oversized value cannot break or bloat the whole record.
|
|
600
|
+
# Whenever a field is degraded, the reason is recorded in a trailing `"truncated"`
|
|
601
|
+
# object that maps the field name to why it was truncated:
|
|
602
|
+
#
|
|
603
|
+
# - `"key": true` — the value was dropped because it did not fit the size limit.
|
|
604
|
+
# - `"key": {error}` — the value could not be serialized directly; a safe
|
|
605
|
+
# representation was kept in its place and the triggering error is recorded.
|
|
606
|
+
#
|
|
607
|
+
# Fields are kept while they fit, always reserving room for at least a minimal
|
|
608
|
+
# `"truncated":true` marker. The detailed reason map is then emitted only if it
|
|
609
|
+
# fits in the remaining space; otherwise it degrades to `"truncated":true`. This
|
|
610
|
+
# is best-effort — in the worst case the per-field detail is lost — but it keeps
|
|
611
|
+
# the bookkeeping simple and the size guarantee hard.
|
|
612
|
+
#
|
|
613
|
+
# @parameter object [Object] The object to serialize.
|
|
614
|
+
# @returns [String] The safe, size-limited serialized record.
|
|
615
|
+
#
|
|
616
|
+
# pkg:gem/console#lib/console/format/safe.rb:87
|
|
617
|
+
def safe_dump(object); end
|
|
618
|
+
|
|
619
|
+
# This will recursively generate a safe version of the object. Nested hashes and arrays will be transformed recursively. Strings will be encoded with the given encoding. Primitive values will be returned as-is. Other values will be converted using `as_json` if available, otherwise `to_s`.
|
|
620
|
+
#
|
|
621
|
+
# @parameter object [Object] The object to dump.
|
|
622
|
+
# @parameter limit [Integer] The maximum depth to recurse into objects.
|
|
623
|
+
# @parameter objects [Hash] The objects that have already been visited.
|
|
624
|
+
# @returns [Object] The dumped object as a primitive representation.
|
|
625
|
+
#
|
|
626
|
+
# pkg:gem/console#lib/console/format/safe.rb:237
|
|
627
|
+
def safe_dump_recurse(object, limit = T.unsafe(nil), objects = T.unsafe(nil)); end
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
# The JSON fragment used as the truncation marker when dropped fields cannot be named.
|
|
631
|
+
#
|
|
632
|
+
# pkg:gem/console#lib/console/format/safe.rb:16
|
|
633
|
+
Console::Format::Safe::TRUNCATED = T.let(T.unsafe(nil), String)
|
|
634
|
+
|
|
635
|
+
# The public logger interface.
|
|
636
|
+
#
|
|
637
|
+
# pkg:gem/console#lib/console/interface.rb:11
|
|
638
|
+
module Console::Interface
|
|
639
|
+
extend ::Fiber::Local
|
|
640
|
+
|
|
641
|
+
# Emit a log message with arbitrary arguments and options.
|
|
642
|
+
#
|
|
643
|
+
# pkg:gem/console#lib/console/interface.rb:57
|
|
644
|
+
def call(*, **, &); end
|
|
645
|
+
|
|
646
|
+
# Emit a debug log message.
|
|
647
|
+
#
|
|
648
|
+
# pkg:gem/console#lib/console/interface.rb:32
|
|
649
|
+
def debug(*, **, &); end
|
|
650
|
+
|
|
651
|
+
# Emit an error log message.
|
|
652
|
+
#
|
|
653
|
+
# pkg:gem/console#lib/console/interface.rb:47
|
|
654
|
+
def error(*, **, &); end
|
|
655
|
+
|
|
656
|
+
# Emit a fatal log message.
|
|
657
|
+
#
|
|
658
|
+
# pkg:gem/console#lib/console/interface.rb:52
|
|
659
|
+
def fatal(*, **, &); end
|
|
660
|
+
|
|
661
|
+
# Emit an informational log message.
|
|
662
|
+
#
|
|
663
|
+
# pkg:gem/console#lib/console/interface.rb:37
|
|
664
|
+
def info(*, **, &); end
|
|
665
|
+
|
|
666
|
+
# Get the current logger instance.
|
|
667
|
+
#
|
|
668
|
+
# pkg:gem/console#lib/console/interface.rb:20
|
|
669
|
+
def logger; end
|
|
670
|
+
|
|
671
|
+
# Set the current logger instance.
|
|
672
|
+
#
|
|
673
|
+
# The current logger instance is assigned per-fiber.
|
|
674
|
+
#
|
|
675
|
+
# pkg:gem/console#lib/console/interface.rb:27
|
|
676
|
+
def logger=(instance); end
|
|
677
|
+
|
|
678
|
+
# Emit a warning log message.
|
|
679
|
+
#
|
|
680
|
+
# pkg:gem/console#lib/console/interface.rb:42
|
|
681
|
+
def warn(*, **, &); end
|
|
682
|
+
|
|
683
|
+
class << self
|
|
684
|
+
# pkg:gem/console#lib/console/interface.rb:12
|
|
685
|
+
def fiber_local_attribute_name; end
|
|
686
|
+
|
|
687
|
+
# Create a new (thread local) logger instance.
|
|
688
|
+
#
|
|
689
|
+
# pkg:gem/console#lib/console/interface.rb:15
|
|
690
|
+
def local; end
|
|
691
|
+
end
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
# The standard logger interface with support for log levels and verbosity.
|
|
695
|
+
#
|
|
696
|
+
# The log levels are: `debug`, `info`, `warn`, `error`, and `fatal`.
|
|
697
|
+
#
|
|
698
|
+
# pkg:gem/console#lib/console/logger.rb:20
|
|
699
|
+
class Console::Logger < ::Console::Filter
|
|
700
|
+
# Create a new logger.
|
|
701
|
+
#
|
|
702
|
+
# @parameter output [Console::Output] The output destination.
|
|
703
|
+
# @parameter options [Hash] Additional options.
|
|
704
|
+
#
|
|
705
|
+
# pkg:gem/console#lib/console/logger.rb:47
|
|
706
|
+
def initialize(output, **options); end
|
|
707
|
+
|
|
708
|
+
# Create a progress indicator for the given subject.
|
|
709
|
+
#
|
|
710
|
+
# @parameter subject [String] The subject of the progress indicator.
|
|
711
|
+
# @parameter total [Integer] The total number of items to process.
|
|
712
|
+
# @parameter options [Hash] Additional options passed to {Progress}.
|
|
713
|
+
# @returns [Progress] The progress indicator.
|
|
714
|
+
#
|
|
715
|
+
# pkg:gem/console#lib/console/logger.rb:60
|
|
716
|
+
def progress(subject, total, **options); end
|
|
717
|
+
|
|
718
|
+
class << self
|
|
719
|
+
# Set the default log level based on `$DEBUG` and `$VERBOSE`.
|
|
720
|
+
# You can also specify CONSOLE_LEVEL=debug or CONSOLE_LEVEL=info in environment.
|
|
721
|
+
# https://mislav.net/2011/06/ruby-verbose-mode/ has more details about how it all fits together.
|
|
722
|
+
#
|
|
723
|
+
# @parameter env [Hash] The environment to read the log level from.
|
|
724
|
+
# @parameter verbose [Boolean] The verbose flag.
|
|
725
|
+
# @parameter debug [Boolean] The debug flag.
|
|
726
|
+
# @returns [Integer] The default log level.
|
|
727
|
+
#
|
|
728
|
+
# pkg:gem/console#lib/console/logger.rb:29
|
|
729
|
+
def default_log_level(env = T.unsafe(nil), verbose: T.unsafe(nil), debug: T.unsafe(nil)); end
|
|
730
|
+
end
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
# pkg:gem/console#lib/console/logger.rb:41
|
|
734
|
+
Console::Logger::DEFAULT_LEVEL = T.let(T.unsafe(nil), Integer)
|
|
735
|
+
|
|
736
|
+
# Output handling.
|
|
737
|
+
#
|
|
738
|
+
# pkg:gem/console#lib/console/output/terminal.rb:16
|
|
739
|
+
module Console::Output
|
|
740
|
+
class << self
|
|
741
|
+
# Create a new output based on the environment.
|
|
742
|
+
#
|
|
743
|
+
# The environment variable `CONSOLE_OUTPUT` can be used to specify a list of output classes to wrap around the output. If not specified the {Default} output is used.
|
|
744
|
+
#
|
|
745
|
+
# The output argument is deliberately unders-specified but can be an IO object or an instance of {Output}.
|
|
746
|
+
#
|
|
747
|
+
# @parameter output [Console::Output] The output to wrap OR an IO object.
|
|
748
|
+
# @parameter env [Hash] The environment to read configuration from.
|
|
749
|
+
# @parameter options [Hash] Additional options to customize the output.
|
|
750
|
+
# @returns [Console::Output] The output instance.
|
|
751
|
+
#
|
|
752
|
+
# pkg:gem/console#lib/console/output.rb:24
|
|
753
|
+
def new(output = T.unsafe(nil), env = T.unsafe(nil), **options); end
|
|
754
|
+
end
|
|
755
|
+
end
|
|
756
|
+
|
|
757
|
+
# Default output format selection.
|
|
758
|
+
#
|
|
759
|
+
# pkg:gem/console#lib/console/output/default.rb:13
|
|
760
|
+
module Console::Output::Default
|
|
761
|
+
class << self
|
|
762
|
+
# Detect if we're running in GitHub Actions, where human-readable output is preferred.
|
|
763
|
+
# GitHub Actions sets the GITHUB_ACTIONS environment variable to "true".
|
|
764
|
+
#
|
|
765
|
+
# pkg:gem/console#lib/console/output/default.rb:46
|
|
766
|
+
def github_actions?(env = T.unsafe(nil)); end
|
|
767
|
+
|
|
768
|
+
# Detect if we're running in a cron job or mail context where human-readable output is preferred.
|
|
769
|
+
# Cron jobs often have MAILTO set and lack TERM, or have minimal TERM values.
|
|
770
|
+
#
|
|
771
|
+
# pkg:gem/console#lib/console/output/default.rb:40
|
|
772
|
+
def mail?(env = T.unsafe(nil)); end
|
|
773
|
+
|
|
774
|
+
# Create a new output format based on the given stream.
|
|
775
|
+
#
|
|
776
|
+
# @parameter io [IO] The output stream.
|
|
777
|
+
# @parameter env [Hash] Environment variables (defaults to ENV for testing).
|
|
778
|
+
# @parameter options [Hash] Additional options to customize the output.
|
|
779
|
+
# @returns [Console::Output::Terminal | Console::Output::Serialized] The output instance, depending on whether the `io` is a terminal or not.
|
|
780
|
+
#
|
|
781
|
+
# pkg:gem/console#lib/console/output/default.rb:20
|
|
782
|
+
def new(stream, env: T.unsafe(nil), **options); end
|
|
783
|
+
end
|
|
784
|
+
end
|
|
785
|
+
|
|
786
|
+
# A wrapper for outputting failure messages, which can include exceptions.
|
|
787
|
+
#
|
|
788
|
+
# pkg:gem/console#lib/console/output/failure.rb:12
|
|
789
|
+
class Console::Output::Failure < ::Console::Output::Wrapper
|
|
790
|
+
# Create a new failure output wrapper.
|
|
791
|
+
#
|
|
792
|
+
# pkg:gem/console#lib/console/output/failure.rb:14
|
|
793
|
+
def initialize(output, **options); end
|
|
794
|
+
|
|
795
|
+
# The exception must be either the last argument or passed as an option.
|
|
796
|
+
#
|
|
797
|
+
# @parameter subject [String] The subject of the message.
|
|
798
|
+
# @parameter arguments [Array] The arguments to output.
|
|
799
|
+
# @parameter exception [Exception] The exception to output.
|
|
800
|
+
# @parameter options [Hash] Additional options to pass to the output.
|
|
801
|
+
# @parameter block [Proc] An optional block to pass to the output.
|
|
802
|
+
#
|
|
803
|
+
# pkg:gem/console#lib/console/output/failure.rb:25
|
|
804
|
+
def call(subject = T.unsafe(nil), *arguments, exception: T.unsafe(nil), **options, &block); end
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
# @deprecated This is a legacy constant, please use `Serialized` instead.
|
|
808
|
+
#
|
|
809
|
+
# pkg:gem/console#lib/console/output/serialized.rb:100
|
|
810
|
+
Console::Output::JSON = Console::Output::Serialized
|
|
811
|
+
|
|
812
|
+
# A null output that does nothing.
|
|
813
|
+
#
|
|
814
|
+
# pkg:gem/console#lib/console/output/null.rb:9
|
|
815
|
+
class Console::Output::Null
|
|
816
|
+
# Create a new null output.
|
|
817
|
+
#
|
|
818
|
+
# pkg:gem/console#lib/console/output/null.rb:11
|
|
819
|
+
def initialize(*, **, &); end
|
|
820
|
+
|
|
821
|
+
# Do nothing.
|
|
822
|
+
#
|
|
823
|
+
# pkg:gem/console#lib/console/output/null.rb:20
|
|
824
|
+
def call(*, **, &); end
|
|
825
|
+
|
|
826
|
+
# The last output is always self.
|
|
827
|
+
#
|
|
828
|
+
# pkg:gem/console#lib/console/output/null.rb:15
|
|
829
|
+
def last_output; end
|
|
830
|
+
end
|
|
831
|
+
|
|
832
|
+
# Serialize log messages in a structured format.
|
|
833
|
+
#
|
|
834
|
+
# pkg:gem/console#lib/console/output/serialized.rb:13
|
|
835
|
+
class Console::Output::Serialized
|
|
836
|
+
# Create a new serialized output.
|
|
837
|
+
#
|
|
838
|
+
# @parameter io [IO] The output stream.
|
|
839
|
+
# @parameter format [Console::Format] The format to use for serializing log messages.
|
|
840
|
+
# @parameter options [Hash] Additional options to customize the output.
|
|
841
|
+
#
|
|
842
|
+
# pkg:gem/console#lib/console/output/serialized.rb:19
|
|
843
|
+
def initialize(stream, format: T.unsafe(nil), **options); end
|
|
844
|
+
|
|
845
|
+
# Output the given log message.
|
|
846
|
+
#
|
|
847
|
+
# @parameter subject [String] The subject of the log message.
|
|
848
|
+
# @parameter arguments [Array] The arguments to log.
|
|
849
|
+
# @parameter severity [Symbol] The severity of the log message.
|
|
850
|
+
# @parameter options [Hash] Additional options.
|
|
851
|
+
# @parameter block [Proc] An optional block used to generate the log message.
|
|
852
|
+
#
|
|
853
|
+
# pkg:gem/console#lib/console/output/serialized.rb:50
|
|
854
|
+
def call(subject = T.unsafe(nil), *arguments, severity: T.unsafe(nil), **options, &block); end
|
|
855
|
+
|
|
856
|
+
# Serialize the given record.
|
|
857
|
+
#
|
|
858
|
+
# @parameter record [Hash] The record to serialize.
|
|
859
|
+
# @returns [String] The serialized record.
|
|
860
|
+
#
|
|
861
|
+
# pkg:gem/console#lib/console/output/serialized.rb:39
|
|
862
|
+
def dump(record); end
|
|
863
|
+
|
|
864
|
+
# @attribute [Console::Format] The format to use for serializing log messages.
|
|
865
|
+
#
|
|
866
|
+
# pkg:gem/console#lib/console/output/serialized.rb:33
|
|
867
|
+
def format; end
|
|
868
|
+
|
|
869
|
+
# This a final output that then writes to an IO object.
|
|
870
|
+
#
|
|
871
|
+
# pkg:gem/console#lib/console/output/serialized.rb:25
|
|
872
|
+
def last_output; end
|
|
873
|
+
|
|
874
|
+
# @attribute [IO] The output stream.
|
|
875
|
+
#
|
|
876
|
+
# pkg:gem/console#lib/console/output/serialized.rb:30
|
|
877
|
+
def stream; end
|
|
878
|
+
end
|
|
879
|
+
|
|
880
|
+
# Represents a terminal output, and formats log messages for display.
|
|
881
|
+
#
|
|
882
|
+
# pkg:gem/console#lib/console/output/terminal.rb:18
|
|
883
|
+
class Console::Output::Terminal
|
|
884
|
+
# Create a new terminal output.
|
|
885
|
+
#
|
|
886
|
+
# @parameter stream [IO] The output stream.
|
|
887
|
+
# @parameter verbose [Boolean] Whether to print verbose output.
|
|
888
|
+
# @parameter start_at [Time] The start time of the terminal output.
|
|
889
|
+
# @parameter format [Console::Terminal::Format] The format to use for terminal output.
|
|
890
|
+
# @parameter options [Hash] Additional options to customize the output.
|
|
891
|
+
#
|
|
892
|
+
# pkg:gem/console#lib/console/output/terminal.rb:72
|
|
893
|
+
def initialize(stream, verbose: T.unsafe(nil), start_at: T.unsafe(nil), format: T.unsafe(nil), **options); end
|
|
894
|
+
|
|
895
|
+
# Log a message with the given severity.
|
|
896
|
+
#
|
|
897
|
+
# @parameter subject [String] The subject of the log message.
|
|
898
|
+
# @parameter arguments [Array] The arguments to log.
|
|
899
|
+
# @parameter name [String | Nil] The optional name of the log message, used as a prefix, otherwise defaults to the severity name.
|
|
900
|
+
# @parameter severity [Symbol] The severity of the log message.
|
|
901
|
+
# @parameter event [Hash] The event to log.
|
|
902
|
+
# @parameter options [Hash] Additional options.
|
|
903
|
+
# @yields {|buffer, terminal| ...} An optional block used to generate the log message.
|
|
904
|
+
# @parameter buffer [Console::Output::Terminal::Buffer] The output buffer.
|
|
905
|
+
# @parameter terminal [Console::Terminal] The terminal instance.
|
|
906
|
+
#
|
|
907
|
+
# pkg:gem/console#lib/console/output/terminal.rb:145
|
|
908
|
+
def call(subject = T.unsafe(nil), *arguments, name: T.unsafe(nil), severity: T.unsafe(nil), event: T.unsafe(nil), **options, &block); end
|
|
909
|
+
|
|
910
|
+
# This a final output.
|
|
911
|
+
#
|
|
912
|
+
# pkg:gem/console#lib/console/output/terminal.rb:100
|
|
913
|
+
def last_output; end
|
|
914
|
+
|
|
915
|
+
# Register all formatters in the given namespace.
|
|
916
|
+
#
|
|
917
|
+
# pkg:gem/console#lib/console/output/terminal.rb:124
|
|
918
|
+
def register_formatters(namespace = T.unsafe(nil)); end
|
|
919
|
+
|
|
920
|
+
# @attribute [Time] The start time of the terminal output.
|
|
921
|
+
#
|
|
922
|
+
# pkg:gem/console#lib/console/output/terminal.rb:111
|
|
923
|
+
def start; end
|
|
924
|
+
|
|
925
|
+
# @attribute [IO] The output stream.
|
|
926
|
+
#
|
|
927
|
+
# pkg:gem/console#lib/console/output/terminal.rb:105
|
|
928
|
+
def stream; end
|
|
929
|
+
|
|
930
|
+
# @attribute [Console::Terminal::Format] The format to use for terminal output.
|
|
931
|
+
#
|
|
932
|
+
# pkg:gem/console#lib/console/output/terminal.rb:114
|
|
933
|
+
def terminal; end
|
|
934
|
+
|
|
935
|
+
# @attribute [Boolean] Whether to print verbose output.
|
|
936
|
+
#
|
|
937
|
+
# pkg:gem/console#lib/console/output/terminal.rb:108
|
|
938
|
+
def verbose; end
|
|
939
|
+
|
|
940
|
+
# Set the verbose output.
|
|
941
|
+
#
|
|
942
|
+
# @parameter value [Boolean] Whether to print verbose output.
|
|
943
|
+
#
|
|
944
|
+
# pkg:gem/console#lib/console/output/terminal.rb:119
|
|
945
|
+
def verbose!(value = T.unsafe(nil)); end
|
|
946
|
+
|
|
947
|
+
# @attribute [Boolean] Whether to print verbose output.
|
|
948
|
+
#
|
|
949
|
+
# pkg:gem/console#lib/console/output/terminal.rb:108
|
|
950
|
+
def verbose=(_arg0); end
|
|
951
|
+
|
|
952
|
+
protected
|
|
953
|
+
|
|
954
|
+
# pkg:gem/console#lib/console/output/terminal.rb:275
|
|
955
|
+
def build_prefix(name); end
|
|
956
|
+
|
|
957
|
+
# pkg:gem/console#lib/console/output/terminal.rb:212
|
|
958
|
+
def default_suffix(object = T.unsafe(nil)); end
|
|
959
|
+
|
|
960
|
+
# pkg:gem/console#lib/console/output/terminal.rb:196
|
|
961
|
+
def format_argument(argument, output); end
|
|
962
|
+
|
|
963
|
+
# pkg:gem/console#lib/console/output/terminal.rb:181
|
|
964
|
+
def format_event(event, buffer, width); end
|
|
965
|
+
|
|
966
|
+
# pkg:gem/console#lib/console/output/terminal.rb:238
|
|
967
|
+
def format_object_subject(severity, prefix, subject, output); end
|
|
968
|
+
|
|
969
|
+
# pkg:gem/console#lib/console/output/terminal.rb:192
|
|
970
|
+
def format_options(options, output); end
|
|
971
|
+
|
|
972
|
+
# pkg:gem/console#lib/console/output/terminal.rb:250
|
|
973
|
+
def format_string_subject(severity, prefix, subject, output); end
|
|
974
|
+
|
|
975
|
+
# pkg:gem/console#lib/console/output/terminal.rb:202
|
|
976
|
+
def format_subject(severity, prefix, subject, buffer); end
|
|
977
|
+
|
|
978
|
+
# pkg:gem/console#lib/console/output/terminal.rb:262
|
|
979
|
+
def format_value(value, output); end
|
|
980
|
+
|
|
981
|
+
# pkg:gem/console#lib/console/output/terminal.rb:271
|
|
982
|
+
def time_offset_prefix; end
|
|
983
|
+
|
|
984
|
+
class << self
|
|
985
|
+
# Exports CONSOLE_START_AT which can be used to synchronize the start times of all child processes when they log using delta time.
|
|
986
|
+
#
|
|
987
|
+
# pkg:gem/console#lib/console/output/terminal.rb:52
|
|
988
|
+
def start_at!(env = T.unsafe(nil)); end
|
|
989
|
+
end
|
|
990
|
+
end
|
|
991
|
+
|
|
992
|
+
# Represents an output buffer that formats lines with a prefix.
|
|
993
|
+
#
|
|
994
|
+
# pkg:gem/console#lib/console/output/terminal.rb:20
|
|
995
|
+
class Console::Output::Terminal::Buffer < ::StringIO
|
|
996
|
+
# Create a new buffer with the given prefix.
|
|
997
|
+
#
|
|
998
|
+
# @parameter prefix [String] The prefix to use for each line.
|
|
999
|
+
#
|
|
1000
|
+
# pkg:gem/console#lib/console/output/terminal.rb:24
|
|
1001
|
+
def initialize(prefix = T.unsafe(nil)); end
|
|
1002
|
+
|
|
1003
|
+
# Write a line to the buffer.
|
|
1004
|
+
#
|
|
1005
|
+
# pkg:gem/console#lib/console/output/terminal.rb:45
|
|
1006
|
+
def <<(*lines, prefix: T.unsafe(nil)); end
|
|
1007
|
+
|
|
1008
|
+
# @attribute [String] The prefix to use for each line.
|
|
1009
|
+
#
|
|
1010
|
+
# pkg:gem/console#lib/console/output/terminal.rb:31
|
|
1011
|
+
def prefix; end
|
|
1012
|
+
|
|
1013
|
+
# Write lines using the given prefix.
|
|
1014
|
+
#
|
|
1015
|
+
# @parameter lines [Array] The lines to write.
|
|
1016
|
+
# @parameter prefix [String] The prefix to use for each line.
|
|
1017
|
+
#
|
|
1018
|
+
# pkg:gem/console#lib/console/output/terminal.rb:37
|
|
1019
|
+
def puts(*lines, prefix: T.unsafe(nil)); end
|
|
1020
|
+
end
|
|
1021
|
+
|
|
1022
|
+
# The environment variable used to store the start time of the console terminal output.
|
|
1023
|
+
#
|
|
1024
|
+
# pkg:gem/console#lib/console/output/terminal.rb:49
|
|
1025
|
+
Console::Output::Terminal::CONSOLE_START_AT = T.let(T.unsafe(nil), String)
|
|
1026
|
+
|
|
1027
|
+
# The default severity for log messages, if not specified.
|
|
1028
|
+
#
|
|
1029
|
+
# pkg:gem/console#lib/console/output/terminal.rb:132
|
|
1030
|
+
Console::Output::Terminal::UNKNOWN = T.let(T.unsafe(nil), Symbol)
|
|
1031
|
+
|
|
1032
|
+
# Terminal text output.
|
|
1033
|
+
#
|
|
1034
|
+
# pkg:gem/console#lib/console/output/terminal.rb:285
|
|
1035
|
+
module Console::Output::Text
|
|
1036
|
+
class << self
|
|
1037
|
+
# Create a new terminal output.
|
|
1038
|
+
#
|
|
1039
|
+
# @parameter output [IO] The output stream.
|
|
1040
|
+
# @parameter options [Hash] Additional options to customize the output.
|
|
1041
|
+
# @returns [Console::Output::Terminal] The terminal output instance.
|
|
1042
|
+
#
|
|
1043
|
+
# pkg:gem/console#lib/console/output/terminal.rb:291
|
|
1044
|
+
def new(output, **options); end
|
|
1045
|
+
end
|
|
1046
|
+
end
|
|
1047
|
+
|
|
1048
|
+
# A generic wrapper for output handling.
|
|
1049
|
+
#
|
|
1050
|
+
# pkg:gem/console#lib/console/output/wrapper.rb:9
|
|
1051
|
+
class Console::Output::Wrapper
|
|
1052
|
+
# Create a new wrapper output.
|
|
1053
|
+
#
|
|
1054
|
+
# @parameter delegate [Console::Output] The output to delegate to.
|
|
1055
|
+
# @parameter options [Hash] Additional options to customize the output.
|
|
1056
|
+
#
|
|
1057
|
+
# pkg:gem/console#lib/console/output/wrapper.rb:14
|
|
1058
|
+
def initialize(delegate, **options); end
|
|
1059
|
+
|
|
1060
|
+
# Invoke the delegate.
|
|
1061
|
+
#
|
|
1062
|
+
# pkg:gem/console#lib/console/output/wrapper.rb:34
|
|
1063
|
+
def call(*, **, &); end
|
|
1064
|
+
|
|
1065
|
+
# @attribute [Console::Output] The output to delegate to.
|
|
1066
|
+
#
|
|
1067
|
+
# pkg:gem/console#lib/console/output/wrapper.rb:19
|
|
1068
|
+
def delegate; end
|
|
1069
|
+
|
|
1070
|
+
# The last output is the last output of the delegate.
|
|
1071
|
+
#
|
|
1072
|
+
# pkg:gem/console#lib/console/output/wrapper.rb:22
|
|
1073
|
+
def last_output; end
|
|
1074
|
+
|
|
1075
|
+
# Set the verbose flag for the delegate.
|
|
1076
|
+
#
|
|
1077
|
+
# @parameter value [Boolean] The new value.
|
|
1078
|
+
#
|
|
1079
|
+
# pkg:gem/console#lib/console/output/wrapper.rb:29
|
|
1080
|
+
def verbose!(value = T.unsafe(nil)); end
|
|
1081
|
+
end
|
|
1082
|
+
|
|
1083
|
+
# Terminal XTerm output.
|
|
1084
|
+
#
|
|
1085
|
+
# pkg:gem/console#lib/console/output/terminal.rb:297
|
|
1086
|
+
module Console::Output::XTerm
|
|
1087
|
+
class << self
|
|
1088
|
+
# Create a new terminal output.
|
|
1089
|
+
#
|
|
1090
|
+
# You can use this to force XTerm output on a non-TTY output streams that support XTerm escape codes.
|
|
1091
|
+
#
|
|
1092
|
+
# @parameter output [IO] The output stream.
|
|
1093
|
+
# @parameter options [Hash] Additional options to customize the output.
|
|
1094
|
+
# @returns [Console::Output::Terminal] The terminal output instance.
|
|
1095
|
+
#
|
|
1096
|
+
# pkg:gem/console#lib/console/output/terminal.rb:305
|
|
1097
|
+
def new(output, **options); end
|
|
1098
|
+
end
|
|
1099
|
+
end
|
|
1100
|
+
|
|
1101
|
+
# A simple progress indicator
|
|
1102
|
+
#
|
|
1103
|
+
# pkg:gem/console#lib/console/progress.rb:11
|
|
1104
|
+
class Console::Progress
|
|
1105
|
+
# Create a new progress indicator.
|
|
1106
|
+
#
|
|
1107
|
+
# @parameter subject [Object] The subject of the progress indicator.
|
|
1108
|
+
# @parameter total [Integer] The total number of steps.
|
|
1109
|
+
# @parameter logger [Console::Logger] The logger to use for output.
|
|
1110
|
+
# @parameter minimum_output_duration [Numeric] The minimum duration between outputs.
|
|
1111
|
+
# @parameter options [Hash] Additional options to customize the output.
|
|
1112
|
+
#
|
|
1113
|
+
# pkg:gem/console#lib/console/progress.rb:24
|
|
1114
|
+
def initialize(subject, total = T.unsafe(nil), logger: T.unsafe(nil), minimum_output_duration: T.unsafe(nil), **options); end
|
|
1115
|
+
|
|
1116
|
+
# @returns [Numeric | Nil] The average duration per step, or `nil` if no steps have been completed.
|
|
1117
|
+
#
|
|
1118
|
+
# pkg:gem/console#lib/console/progress.rb:71
|
|
1119
|
+
def average_duration; end
|
|
1120
|
+
|
|
1121
|
+
# @attribute [Numeric] The current number of steps completed.
|
|
1122
|
+
#
|
|
1123
|
+
# pkg:gem/console#lib/console/progress.rb:48
|
|
1124
|
+
def current; end
|
|
1125
|
+
|
|
1126
|
+
# @returns [Numeric] The duration since the progress indicator was started.
|
|
1127
|
+
#
|
|
1128
|
+
# pkg:gem/console#lib/console/progress.rb:54
|
|
1129
|
+
def duration; end
|
|
1130
|
+
|
|
1131
|
+
# @returns [Numeric | Nil] The estimated remaining time, or `nil` if no steps have been completed.
|
|
1132
|
+
#
|
|
1133
|
+
# pkg:gem/console#lib/console/progress.rb:78
|
|
1134
|
+
def estimated_remaining_time; end
|
|
1135
|
+
|
|
1136
|
+
# Increment the progress indicator by the given amount.
|
|
1137
|
+
#
|
|
1138
|
+
# @parameter amount [Numeric] The amount to increment by.
|
|
1139
|
+
# @returns [Progress] The progress indicator itself.
|
|
1140
|
+
#
|
|
1141
|
+
# pkg:gem/console#lib/console/progress.rb:102
|
|
1142
|
+
def increment(amount = T.unsafe(nil)); end
|
|
1143
|
+
|
|
1144
|
+
# Augment the progress indicator with additional information.
|
|
1145
|
+
#
|
|
1146
|
+
# @parameter *arguments [Array] The arguments to log.
|
|
1147
|
+
# @parameter **options [Hash] Additional options to log.
|
|
1148
|
+
# @parameter &block [Proc] An optional block used to generate the log message.
|
|
1149
|
+
#
|
|
1150
|
+
# pkg:gem/console#lib/console/progress.rb:131
|
|
1151
|
+
def mark(*arguments, **options, &block); end
|
|
1152
|
+
|
|
1153
|
+
# @attribute [Numeric] The minimum duration between outputs.
|
|
1154
|
+
#
|
|
1155
|
+
# pkg:gem/console#lib/console/progress.rb:42
|
|
1156
|
+
def minimum_output_duration; end
|
|
1157
|
+
|
|
1158
|
+
# @returns [Rational] The ratio of steps completed to total steps.
|
|
1159
|
+
#
|
|
1160
|
+
# pkg:gem/console#lib/console/progress.rb:59
|
|
1161
|
+
def ratio; end
|
|
1162
|
+
|
|
1163
|
+
# @returns [Numeric] The number of steps remaining.
|
|
1164
|
+
#
|
|
1165
|
+
# pkg:gem/console#lib/console/progress.rb:66
|
|
1166
|
+
def remaining; end
|
|
1167
|
+
|
|
1168
|
+
# Resize the progress indicator to the given total.
|
|
1169
|
+
#
|
|
1170
|
+
# @parameter total [Numeric] The new total number of steps.
|
|
1171
|
+
# @returns [Progress] The progress indicator itself.
|
|
1172
|
+
#
|
|
1173
|
+
# pkg:gem/console#lib/console/progress.rb:117
|
|
1174
|
+
def resize(total); end
|
|
1175
|
+
|
|
1176
|
+
# @attribute [Time] The time the progress indicator was started.
|
|
1177
|
+
#
|
|
1178
|
+
# pkg:gem/console#lib/console/progress.rb:45
|
|
1179
|
+
def start_time; end
|
|
1180
|
+
|
|
1181
|
+
# @attribute [Object] The subject of the progress indicator.
|
|
1182
|
+
#
|
|
1183
|
+
# pkg:gem/console#lib/console/progress.rb:39
|
|
1184
|
+
def subject; end
|
|
1185
|
+
|
|
1186
|
+
# Generate an appropriate event for the progress indicator.
|
|
1187
|
+
#
|
|
1188
|
+
# @returns [Hash] The progress indicator as a hash.
|
|
1189
|
+
#
|
|
1190
|
+
# pkg:gem/console#lib/console/progress.rb:87
|
|
1191
|
+
def to_hash; end
|
|
1192
|
+
|
|
1193
|
+
# @returns [String] A human-readable representation of the progress indicator.
|
|
1194
|
+
#
|
|
1195
|
+
# pkg:gem/console#lib/console/progress.rb:136
|
|
1196
|
+
def to_s; end
|
|
1197
|
+
|
|
1198
|
+
# @attribute [Numeric] The total number of steps.
|
|
1199
|
+
#
|
|
1200
|
+
# pkg:gem/console#lib/console/progress.rb:51
|
|
1201
|
+
def total; end
|
|
1202
|
+
|
|
1203
|
+
private
|
|
1204
|
+
|
|
1205
|
+
# Compute a time delta since the last output, used for rate limiting the output.
|
|
1206
|
+
#
|
|
1207
|
+
# @returns [Numeric | Nil] The duration since the last output.
|
|
1208
|
+
#
|
|
1209
|
+
# pkg:gem/console#lib/console/progress.rb:149
|
|
1210
|
+
def duration_since_last_output; end
|
|
1211
|
+
|
|
1212
|
+
# Whether an output should be generated at this time, taking into account the remaining steps, and the duration since the last output.
|
|
1213
|
+
#
|
|
1214
|
+
# @returns [Boolean] Whether an output should be generated.
|
|
1215
|
+
#
|
|
1216
|
+
# pkg:gem/console#lib/console/progress.rb:158
|
|
1217
|
+
def output?; end
|
|
1218
|
+
|
|
1219
|
+
class << self
|
|
1220
|
+
# @deprecated Use {Clock.now} instead.
|
|
1221
|
+
#
|
|
1222
|
+
# pkg:gem/console#lib/console/progress.rb:13
|
|
1223
|
+
def now; end
|
|
1224
|
+
end
|
|
1225
|
+
end
|
|
1226
|
+
|
|
1227
|
+
# Represents a class resolver that can be used to set log levels for different classes as they become available.
|
|
1228
|
+
#
|
|
1229
|
+
# pkg:gem/console#lib/console/resolver.rb:11
|
|
1230
|
+
class Console::Resolver
|
|
1231
|
+
# Create a new class resolver.
|
|
1232
|
+
#
|
|
1233
|
+
# pkg:gem/console#lib/console/resolver.rb:63
|
|
1234
|
+
def initialize; end
|
|
1235
|
+
|
|
1236
|
+
# Bind the given class names to the given block. When the class name is resolved into an actual class, the block will be called with the class as an argument.
|
|
1237
|
+
#
|
|
1238
|
+
# If the class is already defined, the block will be called immediately.
|
|
1239
|
+
#
|
|
1240
|
+
# If the class is not defined, the block will be called when the class is defined, using a trace point.
|
|
1241
|
+
#
|
|
1242
|
+
# @parameter names [Array(String)] The class names to bind.
|
|
1243
|
+
# @parameter block [Proc] The block to call when the class is resolved.
|
|
1244
|
+
#
|
|
1245
|
+
# pkg:gem/console#lib/console/resolver.rb:77
|
|
1246
|
+
def bind(names, &block); end
|
|
1247
|
+
|
|
1248
|
+
# Invoked by the trace point when a class is defined.
|
|
1249
|
+
#
|
|
1250
|
+
# This will call the block associated with the class name, if any, and remove it from the list of names to resolve.
|
|
1251
|
+
#
|
|
1252
|
+
# If the list of names is empty, the trace point will be disabled.
|
|
1253
|
+
#
|
|
1254
|
+
# @parameter trace_point [TracePoint] The trace point that triggered the event.
|
|
1255
|
+
#
|
|
1256
|
+
# pkg:gem/console#lib/console/resolver.rb:105
|
|
1257
|
+
def resolve(trace_point); end
|
|
1258
|
+
|
|
1259
|
+
# @parameter klass [Class] The class that was resolved.
|
|
1260
|
+
#
|
|
1261
|
+
# pkg:gem/console#lib/console/resolver.rb:110
|
|
1262
|
+
def resolve_class(klass); end
|
|
1263
|
+
|
|
1264
|
+
# @returns [Boolean] True if the resolver is waiting for classes to be defined.
|
|
1265
|
+
#
|
|
1266
|
+
# pkg:gem/console#lib/console/resolver.rb:94
|
|
1267
|
+
def waiting?; end
|
|
1268
|
+
|
|
1269
|
+
class << self
|
|
1270
|
+
# You can change the log level for different classes using CONSOLE_$LEVEL env vars.
|
|
1271
|
+
#
|
|
1272
|
+
# 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.
|
|
1273
|
+
#
|
|
1274
|
+
# You can enable all log levels for a given class by using `CONSOLE_ON=MyClass`. Similarly you can disable all logging using `CONSOLE_OFF=MyClass`.
|
|
1275
|
+
#
|
|
1276
|
+
# @parameter logger [Logger] A logger instance to set the logging levels on.
|
|
1277
|
+
# @parameter env [Hash] The environment to read levels from.
|
|
1278
|
+
# @returns [Nil] If there were no custom logging levels specified in the environment.
|
|
1279
|
+
# @returns [Resolver] If there were custom logging levels, then the created resolver is returned.
|
|
1280
|
+
#
|
|
1281
|
+
# pkg:gem/console#lib/console/resolver.rb:22
|
|
1282
|
+
def default_resolver(logger, env = T.unsafe(nil)); end
|
|
1283
|
+
end
|
|
1284
|
+
end
|
|
1285
|
+
|
|
1286
|
+
# Styled terminal output.
|
|
1287
|
+
#
|
|
1288
|
+
# pkg:gem/console#lib/console/terminal/text.rb:11
|
|
1289
|
+
module Console::Terminal
|
|
1290
|
+
class << self
|
|
1291
|
+
# Create a new terminal output for the given stream.
|
|
1292
|
+
#
|
|
1293
|
+
# pkg:gem/console#lib/console/terminal.rb:13
|
|
1294
|
+
def for(stream); end
|
|
1295
|
+
end
|
|
1296
|
+
end
|
|
1297
|
+
|
|
1298
|
+
# Formatters for various types of events.
|
|
1299
|
+
#
|
|
1300
|
+
# pkg:gem/console#lib/console/terminal/formatter/progress.rb:8
|
|
1301
|
+
module Console::Terminal::Formatter; end
|
|
1302
|
+
|
|
1303
|
+
# Format a failure event, including the exception message and backtrace.
|
|
1304
|
+
#
|
|
1305
|
+
# pkg:gem/console#lib/console/terminal/formatter/failure.rb:10
|
|
1306
|
+
class Console::Terminal::Formatter::Failure
|
|
1307
|
+
# Create a new failure formatter.
|
|
1308
|
+
#
|
|
1309
|
+
# @param terminal [Terminal::Text] The terminal to use for formatting.
|
|
1310
|
+
#
|
|
1311
|
+
# pkg:gem/console#lib/console/terminal/formatter/failure.rb:17
|
|
1312
|
+
def initialize(terminal); end
|
|
1313
|
+
|
|
1314
|
+
# Format the given event.
|
|
1315
|
+
#
|
|
1316
|
+
# @parameter event [Hash] The event to format.
|
|
1317
|
+
# @parameter stream [IO] The stream to write the formatted event to.
|
|
1318
|
+
# @parameter prefix [String] The prefix to use before the title.
|
|
1319
|
+
# @parameter verbose [Boolean] Whether to include additional information.
|
|
1320
|
+
# @parameter options [Hash] Additional options.
|
|
1321
|
+
#
|
|
1322
|
+
# pkg:gem/console#lib/console/terminal/formatter/failure.rb:34
|
|
1323
|
+
def format(event, stream, prefix: T.unsafe(nil), verbose: T.unsafe(nil), **options); end
|
|
1324
|
+
end
|
|
1325
|
+
|
|
1326
|
+
# The key used to identify this formatter.
|
|
1327
|
+
#
|
|
1328
|
+
# pkg:gem/console#lib/console/terminal/formatter/failure.rb:12
|
|
1329
|
+
Console::Terminal::Formatter::Failure::KEY = T.let(T.unsafe(nil), Symbol)
|
|
1330
|
+
|
|
1331
|
+
# Format a progress event, including the current progress and total.
|
|
1332
|
+
#
|
|
1333
|
+
# pkg:gem/console#lib/console/terminal/formatter/progress.rb:10
|
|
1334
|
+
class Console::Terminal::Formatter::Progress
|
|
1335
|
+
# Create a new progress formatter.
|
|
1336
|
+
#
|
|
1337
|
+
# @param terminal [Terminal::Text] The terminal to use for formatting.
|
|
1338
|
+
#
|
|
1339
|
+
# pkg:gem/console#lib/console/terminal/formatter/progress.rb:30
|
|
1340
|
+
def initialize(terminal); end
|
|
1341
|
+
|
|
1342
|
+
# Format the given event.
|
|
1343
|
+
#
|
|
1344
|
+
# @parameter event [Hash] The event to format.
|
|
1345
|
+
# @parameter stream [IO] The stream to write the formatted event to.
|
|
1346
|
+
# @parameter verbose [Boolean] Whether to include additional information.
|
|
1347
|
+
# @parameter width [Integer] The width of the progress bar.
|
|
1348
|
+
#
|
|
1349
|
+
# pkg:gem/console#lib/console/terminal/formatter/progress.rb:41
|
|
1350
|
+
def format(event, stream, verbose: T.unsafe(nil), width: T.unsafe(nil)); end
|
|
1351
|
+
|
|
1352
|
+
private
|
|
1353
|
+
|
|
1354
|
+
# Render a progress bar with the given value and width.
|
|
1355
|
+
#
|
|
1356
|
+
# pkg:gem/console#lib/console/terminal/formatter/progress.rb:55
|
|
1357
|
+
def bar(value, width); end
|
|
1358
|
+
end
|
|
1359
|
+
|
|
1360
|
+
# The block characters used to render the progress bar.
|
|
1361
|
+
#
|
|
1362
|
+
# pkg:gem/console#lib/console/terminal/formatter/progress.rb:15
|
|
1363
|
+
Console::Terminal::Formatter::Progress::BLOCK = T.let(T.unsafe(nil), Array)
|
|
1364
|
+
|
|
1365
|
+
# The key used to identify this formatter.
|
|
1366
|
+
#
|
|
1367
|
+
# pkg:gem/console#lib/console/terminal/formatter/progress.rb:12
|
|
1368
|
+
Console::Terminal::Formatter::Progress::KEY = T.let(T.unsafe(nil), Symbol)
|
|
1369
|
+
|
|
1370
|
+
# Format a spawn event, including the command and arguments.
|
|
1371
|
+
#
|
|
1372
|
+
# pkg:gem/console#lib/console/terminal/formatter/spawn.rb:10
|
|
1373
|
+
class Console::Terminal::Formatter::Spawn
|
|
1374
|
+
# Create a new spawn formatter.
|
|
1375
|
+
#
|
|
1376
|
+
# @param terminal [Terminal::Text] The terminal to use for formatting.
|
|
1377
|
+
#
|
|
1378
|
+
# pkg:gem/console#lib/console/terminal/formatter/spawn.rb:17
|
|
1379
|
+
def initialize(terminal); end
|
|
1380
|
+
|
|
1381
|
+
# Format the given event.
|
|
1382
|
+
#
|
|
1383
|
+
# @parameter event [Hash] The event to format.
|
|
1384
|
+
# @parameter stream [IO] The stream to write the formatted event to.
|
|
1385
|
+
# @parameter verbose [Boolean] Whether to include additional information.
|
|
1386
|
+
# @parameter width [Integer] The width of the progress bar.
|
|
1387
|
+
#
|
|
1388
|
+
# pkg:gem/console#lib/console/terminal/formatter/spawn.rb:28
|
|
1389
|
+
def format(event, stream, verbose: T.unsafe(nil), width: T.unsafe(nil)); end
|
|
1390
|
+
|
|
1391
|
+
private
|
|
1392
|
+
|
|
1393
|
+
# Generate a string to represent the working directory.
|
|
1394
|
+
#
|
|
1395
|
+
# pkg:gem/console#lib/console/terminal/formatter/spawn.rb:45
|
|
1396
|
+
def chdir_string(options); end
|
|
1397
|
+
end
|
|
1398
|
+
|
|
1399
|
+
# The key used to identify this formatter.
|
|
1400
|
+
#
|
|
1401
|
+
# pkg:gem/console#lib/console/terminal/formatter/spawn.rb:12
|
|
1402
|
+
Console::Terminal::Formatter::Spawn::KEY = T.let(T.unsafe(nil), Symbol)
|
|
1403
|
+
|
|
1404
|
+
# A simple text-based terminal output.
|
|
1405
|
+
#
|
|
1406
|
+
# pkg:gem/console#lib/console/terminal/text.rb:13
|
|
1407
|
+
class Console::Terminal::Text
|
|
1408
|
+
# Create a new text terminal output.
|
|
1409
|
+
#
|
|
1410
|
+
# @parameter stream [IO] The stream to write to.
|
|
1411
|
+
#
|
|
1412
|
+
# pkg:gem/console#lib/console/terminal/text.rb:17
|
|
1413
|
+
def initialize(stream); end
|
|
1414
|
+
|
|
1415
|
+
# Get the style associated with the given key.
|
|
1416
|
+
#
|
|
1417
|
+
# @parameter key [Symbol] The key to look up.
|
|
1418
|
+
# @returns [String] The style associated with the key.
|
|
1419
|
+
#
|
|
1420
|
+
# pkg:gem/console#lib/console/terminal/text.rb:29
|
|
1421
|
+
def [](key); end
|
|
1422
|
+
|
|
1423
|
+
# Set the style associated with the given key.
|
|
1424
|
+
#
|
|
1425
|
+
# @parameter key [Symbol] The key to associate the style with.
|
|
1426
|
+
# @parameter value [String] The style to associate with the key.
|
|
1427
|
+
#
|
|
1428
|
+
# pkg:gem/console#lib/console/terminal/text.rb:37
|
|
1429
|
+
def []=(key, value); end
|
|
1430
|
+
|
|
1431
|
+
# @returns [Boolean] Whether the terminal supports colors.
|
|
1432
|
+
#
|
|
1433
|
+
# pkg:gem/console#lib/console/terminal/text.rb:42
|
|
1434
|
+
def colors?; end
|
|
1435
|
+
|
|
1436
|
+
# Print rich text to the output stream.
|
|
1437
|
+
#
|
|
1438
|
+
# - When the argument is a symbol, look up the style and inject it into the output stream.
|
|
1439
|
+
# - When the argument is a proc/lambda, call it with self as the argument.
|
|
1440
|
+
# - When the argument is anything else, write it directly to the output.
|
|
1441
|
+
#
|
|
1442
|
+
# @parameter arguments [Array] The arguments to print.
|
|
1443
|
+
#
|
|
1444
|
+
# pkg:gem/console#lib/console/terminal/text.rb:107
|
|
1445
|
+
def print(*arguments); end
|
|
1446
|
+
|
|
1447
|
+
# Print rich text to the output stream, followed by the reset sequence and a newline.
|
|
1448
|
+
#
|
|
1449
|
+
# @parameter arguments [Array] The arguments to print.
|
|
1450
|
+
#
|
|
1451
|
+
# pkg:gem/console#lib/console/terminal/text.rb:123
|
|
1452
|
+
def print_line(*arguments); end
|
|
1453
|
+
|
|
1454
|
+
# Write the given arguments to the output stream using the given style. The reset sequence is automatically
|
|
1455
|
+
# appended at the end of each line.
|
|
1456
|
+
#
|
|
1457
|
+
# @parameter arguments [Array] The arguments to write, each on a new line.
|
|
1458
|
+
# @parameter style [Symbol] The style to apply.
|
|
1459
|
+
#
|
|
1460
|
+
# pkg:gem/console#lib/console/terminal/text.rb:87
|
|
1461
|
+
def puts(*arguments, style: T.unsafe(nil)); end
|
|
1462
|
+
|
|
1463
|
+
# Generate a reset sequence.
|
|
1464
|
+
#
|
|
1465
|
+
# @returns [String | Nil] The reset sequence if colors are supported, otherwise nil.
|
|
1466
|
+
#
|
|
1467
|
+
# pkg:gem/console#lib/console/terminal/text.rb:65
|
|
1468
|
+
def reset; end
|
|
1469
|
+
|
|
1470
|
+
# @returns [Tuple(Integer, Integer)] The size of the terminal, or a default value of [24, 80].
|
|
1471
|
+
#
|
|
1472
|
+
# pkg:gem/console#lib/console/terminal/text.rb:47
|
|
1473
|
+
def size; end
|
|
1474
|
+
|
|
1475
|
+
# @attribute [IO] The stream to write to.
|
|
1476
|
+
#
|
|
1477
|
+
# pkg:gem/console#lib/console/terminal/text.rb:23
|
|
1478
|
+
def stream; end
|
|
1479
|
+
|
|
1480
|
+
# Generate a style string for the given foreground, background, and attributes.
|
|
1481
|
+
#
|
|
1482
|
+
# @returns [String | Nil] The style string if colors are supported, otherwise nil.
|
|
1483
|
+
#
|
|
1484
|
+
# pkg:gem/console#lib/console/terminal/text.rb:59
|
|
1485
|
+
def style(foreground, background = T.unsafe(nil), *attributes); end
|
|
1486
|
+
|
|
1487
|
+
# @returns [Integer] The width of the terminal.
|
|
1488
|
+
#
|
|
1489
|
+
# pkg:gem/console#lib/console/terminal/text.rb:52
|
|
1490
|
+
def width; end
|
|
1491
|
+
|
|
1492
|
+
# Write the given arguments to the output stream using the given style. The reset sequence is automatically appended.
|
|
1493
|
+
#
|
|
1494
|
+
# @parameter arguments [Array] The arguments to write.
|
|
1495
|
+
# @parameter style [Symbol] The style to apply.
|
|
1496
|
+
#
|
|
1497
|
+
# pkg:gem/console#lib/console/terminal/text.rb:72
|
|
1498
|
+
def write(*arguments, style: T.unsafe(nil)); end
|
|
1499
|
+
end
|
|
1500
|
+
|
|
1501
|
+
# XTerm style terminal output.
|
|
1502
|
+
#
|
|
1503
|
+
# pkg:gem/console#lib/console/terminal/xterm.rb:14
|
|
1504
|
+
class Console::Terminal::XTerm < ::Console::Terminal::Text
|
|
1505
|
+
# Whether the terminal supports colors.
|
|
1506
|
+
#
|
|
1507
|
+
# pkg:gem/console#lib/console/terminal/xterm.rb:42
|
|
1508
|
+
def colors?; end
|
|
1509
|
+
|
|
1510
|
+
# Reset the style.
|
|
1511
|
+
#
|
|
1512
|
+
# @returns [String] The reset code.
|
|
1513
|
+
#
|
|
1514
|
+
# pkg:gem/console#lib/console/terminal/xterm.rb:86
|
|
1515
|
+
def reset; end
|
|
1516
|
+
|
|
1517
|
+
# The size of the terminal.
|
|
1518
|
+
#
|
|
1519
|
+
# pkg:gem/console#lib/console/terminal/xterm.rb:47
|
|
1520
|
+
def size; end
|
|
1521
|
+
|
|
1522
|
+
# Apply the given style to the output.
|
|
1523
|
+
#
|
|
1524
|
+
# @parameter foreground [Symbol] The foreground color.
|
|
1525
|
+
# @parameter background [Symbol] The background color.
|
|
1526
|
+
# @parameter attributes [Array(Symbol)] The attributes to apply.
|
|
1527
|
+
# @returns [String] The style code.
|
|
1528
|
+
#
|
|
1529
|
+
# pkg:gem/console#lib/console/terminal/xterm.rb:65
|
|
1530
|
+
def style(foreground, background = T.unsafe(nil), *attributes); end
|
|
1531
|
+
|
|
1532
|
+
# The width of the terminal.
|
|
1533
|
+
#
|
|
1534
|
+
# pkg:gem/console#lib/console/terminal/xterm.rb:55
|
|
1535
|
+
def width; end
|
|
1536
|
+
end
|
|
1537
|
+
|
|
1538
|
+
# XTerm attribute codes.
|
|
1539
|
+
#
|
|
1540
|
+
# pkg:gem/console#lib/console/terminal/xterm.rb:29
|
|
1541
|
+
Console::Terminal::XTerm::ATTRIBUTES = T.let(T.unsafe(nil), Hash)
|
|
1542
|
+
|
|
1543
|
+
# XTerm color codes.
|
|
1544
|
+
#
|
|
1545
|
+
# pkg:gem/console#lib/console/terminal/xterm.rb:16
|
|
1546
|
+
Console::Terminal::XTerm::COLORS = T.let(T.unsafe(nil), Hash)
|
|
1547
|
+
|
|
1548
|
+
# pkg:gem/console#lib/console/filter.rb:11
|
|
1549
|
+
Console::UNKNOWN = T.let(T.unsafe(nil), Symbol)
|
|
1550
|
+
|
|
1551
|
+
# pkg:gem/console#lib/console/version.rb:7
|
|
1552
|
+
Console::VERSION = T.let(T.unsafe(nil), String)
|