rbs 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +23 -0
- data/README.md +6 -1
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +472 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1059 -139
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2315 -316
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/cli.rb +45 -1
- data/lib/rbs/definition_builder.rb +5 -1
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +59 -0
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1146 -144
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/net-http.rbs +1492 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +420 -106
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +556 -327
- data/stdlib/uri/0/http.rbs +26 -115
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +17 -5
- data/lib/rbs/location.rb +0 -221
@@ -1,17 +1,41 @@
|
|
1
|
+
%a{annotate:rdoc:skip}
|
1
2
|
class Logger
|
3
|
+
# <!-- rdoc-file=lib/logger/formatter.rb -->
|
4
|
+
# Default formatter for log messages.
|
5
|
+
#
|
2
6
|
class Formatter
|
3
7
|
public
|
4
8
|
|
5
9
|
attr_accessor datetime_format: String?
|
6
10
|
|
11
|
+
# <!--
|
12
|
+
# rdoc-file=lib/logger/formatter.rb
|
13
|
+
# - call(severity, time, progname, msg)
|
14
|
+
# -->
|
15
|
+
#
|
7
16
|
def call: (String severity, Time time, untyped progname, untyped msg) -> String
|
8
17
|
|
9
18
|
private
|
10
19
|
|
20
|
+
# <!--
|
21
|
+
# rdoc-file=lib/logger/formatter.rb
|
22
|
+
# - format_datetime(time)
|
23
|
+
# -->
|
24
|
+
#
|
11
25
|
def format_datetime: (Time time) -> untyped
|
12
26
|
|
27
|
+
# <!--
|
28
|
+
# rdoc-file=lib/logger/formatter.rb
|
29
|
+
# - new()
|
30
|
+
# -->
|
31
|
+
#
|
13
32
|
def initialize: () -> void
|
14
33
|
|
34
|
+
# <!--
|
35
|
+
# rdoc-file=lib/logger/formatter.rb
|
36
|
+
# - msg2str(msg)
|
37
|
+
# -->
|
38
|
+
#
|
15
39
|
def msg2str: (String | Exception | untyped msg) -> String
|
16
40
|
end
|
17
41
|
|
@@ -1,4 +1,8 @@
|
|
1
|
+
%a{annotate:rdoc:skip}
|
1
2
|
class Logger
|
3
|
+
# <!-- rdoc-file=lib/logger/log_device.rb -->
|
4
|
+
# Device used for logging messages.
|
5
|
+
#
|
2
6
|
class LogDevice
|
3
7
|
include MonitorMixin
|
4
8
|
|
@@ -9,30 +13,90 @@ class Logger
|
|
9
13
|
|
10
14
|
public
|
11
15
|
|
16
|
+
# <!--
|
17
|
+
# rdoc-file=lib/logger/log_device.rb
|
18
|
+
# - close()
|
19
|
+
# -->
|
20
|
+
#
|
12
21
|
def close: () -> nil
|
13
22
|
|
23
|
+
# <!--
|
24
|
+
# rdoc-file=lib/logger/log_device.rb
|
25
|
+
# - reopen(log = nil)
|
26
|
+
# -->
|
27
|
+
#
|
14
28
|
def reopen: (?logdev log) -> self
|
15
29
|
|
30
|
+
# <!--
|
31
|
+
# rdoc-file=lib/logger/log_device.rb
|
32
|
+
# - write(message)
|
33
|
+
# -->
|
34
|
+
#
|
16
35
|
def write: (untyped message) -> untyped
|
17
36
|
|
18
37
|
private
|
19
38
|
|
39
|
+
# <!--
|
40
|
+
# rdoc-file=lib/logger/log_device.rb
|
41
|
+
# - add_log_header(file)
|
42
|
+
# -->
|
43
|
+
#
|
20
44
|
def add_log_header: (IO file) -> untyped
|
21
45
|
|
46
|
+
# <!--
|
47
|
+
# rdoc-file=lib/logger/log_device.rb
|
48
|
+
# - check_shift_log()
|
49
|
+
# -->
|
50
|
+
#
|
22
51
|
def check_shift_log: () -> untyped
|
23
52
|
|
53
|
+
# <!--
|
54
|
+
# rdoc-file=lib/logger/log_device.rb
|
55
|
+
# - create_logfile(filename)
|
56
|
+
# -->
|
57
|
+
#
|
24
58
|
def create_logfile: (String filename) -> File
|
25
59
|
|
60
|
+
# <!--
|
61
|
+
# rdoc-file=lib/logger/log_device.rb
|
62
|
+
# - new(log = nil, shift_age: nil, shift_size: nil, shift_period_suffix: nil, binmode: false)
|
63
|
+
# -->
|
64
|
+
#
|
26
65
|
def initialize: (?untyped logdev, ?binmode: boolish, ?shift_period_suffix: String, ?shift_size: Integer, ?shift_age: Numeric | String) -> void
|
27
66
|
|
67
|
+
# <!--
|
68
|
+
# rdoc-file=lib/logger/log_device.rb
|
69
|
+
# - lock_shift_log() { || ... }
|
70
|
+
# -->
|
71
|
+
#
|
28
72
|
def lock_shift_log: () { () -> untyped } -> untyped
|
29
73
|
|
74
|
+
# <!--
|
75
|
+
# rdoc-file=lib/logger/log_device.rb
|
76
|
+
# - open_logfile(filename)
|
77
|
+
# -->
|
78
|
+
#
|
30
79
|
def open_logfile: (String filename) -> File
|
31
80
|
|
81
|
+
# <!--
|
82
|
+
# rdoc-file=lib/logger/log_device.rb
|
83
|
+
# - set_dev(log)
|
84
|
+
# -->
|
85
|
+
#
|
32
86
|
def set_dev: (logdev log) -> untyped
|
33
87
|
|
88
|
+
# <!--
|
89
|
+
# rdoc-file=lib/logger/log_device.rb
|
90
|
+
# - shift_log_age()
|
91
|
+
# -->
|
92
|
+
#
|
34
93
|
def shift_log_age: () -> true
|
35
94
|
|
95
|
+
# <!--
|
96
|
+
# rdoc-file=lib/logger/log_device.rb
|
97
|
+
# - shift_log_period(period_end)
|
98
|
+
# -->
|
99
|
+
#
|
36
100
|
def shift_log_period: (Time period_end) -> true
|
37
101
|
end
|
38
102
|
end
|
data/stdlib/logger/0/logger.rbs
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# <!-- rdoc-file=lib/logger.rb -->
|
1
2
|
# ## Description
|
2
3
|
#
|
3
4
|
# The Logger class provides a simple but sophisticated logging utility that you
|
@@ -217,6 +218,9 @@
|
|
217
218
|
# "#{datetime}: #{msg}\n"
|
218
219
|
# })
|
219
220
|
#
|
221
|
+
# <!-- rdoc-file=lib/logger/errors.rb -->
|
222
|
+
# not used after 1.2.7. just for compat.
|
223
|
+
#
|
220
224
|
class Logger
|
221
225
|
interface _WriteCloser
|
222
226
|
def write: (_ToS) -> untyped
|
@@ -229,11 +233,19 @@ class Logger
|
|
229
233
|
|
230
234
|
public
|
231
235
|
|
236
|
+
# <!--
|
237
|
+
# rdoc-file=lib/logger.rb
|
238
|
+
# - <<(msg)
|
239
|
+
# -->
|
232
240
|
# Dump given message to the log device without any formatting. If no log device
|
233
241
|
# exists, return `nil`.
|
234
242
|
#
|
235
243
|
def <<: (untyped msg) -> (untyped | nil)
|
236
244
|
|
245
|
+
# <!--
|
246
|
+
# rdoc-file=lib/logger.rb
|
247
|
+
# - Logger#add(severity, message = nil, progname = nil) { ... }
|
248
|
+
# -->
|
237
249
|
# ### Args
|
238
250
|
#
|
239
251
|
# `severity`
|
@@ -273,14 +285,26 @@ class Logger
|
|
273
285
|
#
|
274
286
|
def add: (Integer severity, ?untyped message, ?untyped progname) ?{ () -> untyped } -> true
|
275
287
|
|
288
|
+
# <!--
|
289
|
+
# rdoc-file=lib/logger.rb
|
290
|
+
# - close()
|
291
|
+
# -->
|
276
292
|
# Close the logging device.
|
277
293
|
#
|
278
294
|
def close: () -> untyped
|
279
295
|
|
296
|
+
# <!--
|
297
|
+
# rdoc-file=lib/logger.rb
|
298
|
+
# - datetime_format()
|
299
|
+
# -->
|
280
300
|
# Returns the date format being used. See #datetime_format=
|
281
301
|
#
|
282
302
|
def datetime_format: () -> String?
|
283
303
|
|
304
|
+
# <!--
|
305
|
+
# rdoc-file=lib/logger.rb
|
306
|
+
# - datetime_format=(datetime_format)
|
307
|
+
# -->
|
284
308
|
# Set date-time format.
|
285
309
|
#
|
286
310
|
# `datetime_format`
|
@@ -289,51 +313,88 @@ class Logger
|
|
289
313
|
def datetime_format=: (String datetime_format) -> String
|
290
314
|
| (nil datetime_format) -> nil
|
291
315
|
|
316
|
+
# <!--
|
317
|
+
# rdoc-file=lib/logger.rb
|
318
|
+
# - debug(progname = nil, &block)
|
319
|
+
# -->
|
292
320
|
# Log a `DEBUG` message.
|
293
321
|
#
|
294
322
|
# See #info for more information.
|
295
323
|
#
|
296
324
|
def debug: (?untyped progname) ?{ () -> untyped } -> true
|
297
325
|
|
326
|
+
# <!--
|
327
|
+
# rdoc-file=lib/logger.rb
|
328
|
+
# - debug!()
|
329
|
+
# -->
|
298
330
|
# Sets the severity to DEBUG.
|
299
331
|
#
|
300
332
|
def debug!: () -> Integer
|
301
333
|
|
302
|
-
#
|
303
|
-
#
|
334
|
+
# <!--
|
335
|
+
# rdoc-file=lib/logger.rb
|
336
|
+
# - debug?()
|
337
|
+
# -->
|
338
|
+
# Returns `true` if and only if the current severity level allows for the
|
339
|
+
# printing of `DEBUG` messages.
|
304
340
|
#
|
305
341
|
def debug?: () -> bool
|
306
342
|
|
343
|
+
# <!--
|
344
|
+
# rdoc-file=lib/logger.rb
|
345
|
+
# - error(progname = nil, &block)
|
346
|
+
# -->
|
307
347
|
# Log an `ERROR` message.
|
308
348
|
#
|
309
349
|
# See #info for more information.
|
310
350
|
#
|
311
351
|
def error: (?untyped progname) ?{ () -> untyped } -> true
|
312
352
|
|
353
|
+
# <!--
|
354
|
+
# rdoc-file=lib/logger.rb
|
355
|
+
# - error!()
|
356
|
+
# -->
|
313
357
|
# Sets the severity to ERROR.
|
314
358
|
#
|
315
359
|
def error!: () -> Integer
|
316
360
|
|
317
|
-
#
|
318
|
-
#
|
361
|
+
# <!--
|
362
|
+
# rdoc-file=lib/logger.rb
|
363
|
+
# - error?()
|
364
|
+
# -->
|
365
|
+
# Returns `true` if and only if the current severity level allows for the
|
366
|
+
# printing of `ERROR` messages.
|
319
367
|
#
|
320
368
|
def error?: () -> bool
|
321
369
|
|
370
|
+
# <!--
|
371
|
+
# rdoc-file=lib/logger.rb
|
372
|
+
# - fatal(progname = nil, &block)
|
373
|
+
# -->
|
322
374
|
# Log a `FATAL` message.
|
323
375
|
#
|
324
376
|
# See #info for more information.
|
325
377
|
#
|
326
378
|
def fatal: (?untyped progname) ?{ () -> untyped } -> true
|
327
379
|
|
380
|
+
# <!--
|
381
|
+
# rdoc-file=lib/logger.rb
|
382
|
+
# - fatal!()
|
383
|
+
# -->
|
328
384
|
# Sets the severity to FATAL.
|
329
385
|
#
|
330
386
|
def fatal!: () -> Integer
|
331
387
|
|
332
|
-
#
|
333
|
-
#
|
388
|
+
# <!--
|
389
|
+
# rdoc-file=lib/logger.rb
|
390
|
+
# - fatal?()
|
391
|
+
# -->
|
392
|
+
# Returns `true` if and only if the current severity level allows for the
|
393
|
+
# printing of `FATAL` messages.
|
334
394
|
#
|
335
395
|
def fatal?: () -> bool
|
336
396
|
|
397
|
+
# <!-- rdoc-file=lib/logger.rb -->
|
337
398
|
# Logging formatter, as a `Proc` that will take four arguments and return the
|
338
399
|
# formatted message. The arguments are:
|
339
400
|
#
|
@@ -352,9 +413,31 @@ class Logger
|
|
352
413
|
#
|
353
414
|
def formatter: () -> (_Formatter | nil)
|
354
415
|
|
416
|
+
# <!-- rdoc-file=lib/logger.rb -->
|
417
|
+
# Logging formatter, as a `Proc` that will take four arguments and return the
|
418
|
+
# formatted message. The arguments are:
|
419
|
+
#
|
420
|
+
# `severity`
|
421
|
+
# : The Severity of the log message.
|
422
|
+
# `time`
|
423
|
+
# : A Time instance representing when the message was logged.
|
424
|
+
# `progname`
|
425
|
+
# : The #progname configured, or passed to the logger method.
|
426
|
+
# `msg`
|
427
|
+
# : The *Object* the user passed to the log message; not necessarily a String.
|
428
|
+
#
|
429
|
+
#
|
430
|
+
# The block should return an Object that can be written to the logging device
|
431
|
+
# via `write`. The default formatter is used when no formatter is set.
|
432
|
+
#
|
355
433
|
def formatter=: (_Formatter) -> _Formatter
|
356
434
|
| (nil) -> nil
|
357
435
|
|
436
|
+
# <!--
|
437
|
+
# rdoc-file=lib/logger.rb
|
438
|
+
# - info(message)
|
439
|
+
# - info(progname, &block)
|
440
|
+
# -->
|
358
441
|
# Log an `INFO` message.
|
359
442
|
#
|
360
443
|
# `message`
|
@@ -386,35 +469,61 @@ class Logger
|
|
386
469
|
#
|
387
470
|
def info: (?untyped progname) ?{ () -> untyped } -> true
|
388
471
|
|
472
|
+
# <!--
|
473
|
+
# rdoc-file=lib/logger.rb
|
474
|
+
# - info!()
|
475
|
+
# -->
|
389
476
|
# Sets the severity to INFO.
|
390
477
|
#
|
391
478
|
def info!: () -> Integer
|
392
479
|
|
393
|
-
#
|
394
|
-
#
|
480
|
+
# <!--
|
481
|
+
# rdoc-file=lib/logger.rb
|
482
|
+
# - info?()
|
483
|
+
# -->
|
484
|
+
# Returns `true` if and only if the current severity level allows for the
|
485
|
+
# printing of `INFO` messages.
|
395
486
|
#
|
396
487
|
def info?: () -> bool
|
397
488
|
|
489
|
+
# <!-- rdoc-file=lib/logger.rb -->
|
398
490
|
# Logging severity threshold (e.g. `Logger::INFO`).
|
399
491
|
#
|
400
492
|
def level: () -> Integer
|
401
493
|
|
494
|
+
# <!--
|
495
|
+
# rdoc-file=lib/logger.rb
|
496
|
+
# - level=(severity)
|
497
|
+
# -->
|
402
498
|
# Set logging severity threshold.
|
403
499
|
#
|
404
500
|
# `severity`
|
405
501
|
# : The Severity of the log message.
|
406
502
|
#
|
407
|
-
#
|
408
503
|
def level=: (Integer | String severity) -> Integer
|
409
504
|
|
505
|
+
# <!--
|
506
|
+
# rdoc-file=lib/logger.rb
|
507
|
+
# - log(severity, message = nil, progname = nil)
|
508
|
+
# -->
|
509
|
+
#
|
410
510
|
alias log add
|
411
511
|
|
512
|
+
# <!-- rdoc-file=lib/logger.rb -->
|
412
513
|
# Program name to include in log messages.
|
413
514
|
#
|
414
515
|
def progname: () -> untyped
|
415
516
|
|
517
|
+
# <!-- rdoc-file=lib/logger.rb -->
|
518
|
+
# Program name to include in log messages.
|
519
|
+
#
|
416
520
|
def progname=: (untyped) -> untyped
|
417
521
|
|
522
|
+
# <!--
|
523
|
+
# rdoc-file=lib/logger.rb
|
524
|
+
# - Logger#reopen
|
525
|
+
# - Logger#reopen(logdev)
|
526
|
+
# -->
|
418
527
|
# ### Args
|
419
528
|
#
|
420
529
|
# `logdev`
|
@@ -430,12 +539,22 @@ class Logger
|
|
430
539
|
def reopen: () -> self
|
431
540
|
| (logdev?) -> self
|
432
541
|
|
542
|
+
# <!-- rdoc-file=lib/logger.rb -->
|
433
543
|
# Logging severity threshold (e.g. `Logger::INFO`).
|
434
544
|
#
|
435
545
|
alias sev_threshold level
|
436
546
|
|
547
|
+
# <!--
|
548
|
+
# rdoc-file=lib/logger.rb
|
549
|
+
# - sev_threshold=(severity)
|
550
|
+
# -->
|
551
|
+
#
|
437
552
|
alias sev_threshold= level=
|
438
553
|
|
554
|
+
# <!--
|
555
|
+
# rdoc-file=lib/logger.rb
|
556
|
+
# - unknown(progname = nil, &block)
|
557
|
+
# -->
|
439
558
|
# Log an `UNKNOWN` message. This will be printed no matter what the logger's
|
440
559
|
# level is.
|
441
560
|
#
|
@@ -443,32 +562,64 @@ class Logger
|
|
443
562
|
#
|
444
563
|
def unknown: (?untyped progname) ?{ () -> untyped } -> true
|
445
564
|
|
565
|
+
# <!--
|
566
|
+
# rdoc-file=lib/logger.rb
|
567
|
+
# - warn(progname = nil, &block)
|
568
|
+
# -->
|
446
569
|
# Log a `WARN` message.
|
447
570
|
#
|
448
571
|
# See #info for more information.
|
449
572
|
#
|
450
573
|
def warn: (?untyped progname) ?{ () -> untyped } -> true
|
451
574
|
|
575
|
+
# <!--
|
576
|
+
# rdoc-file=lib/logger.rb
|
577
|
+
# - warn!()
|
578
|
+
# -->
|
452
579
|
# Sets the severity to WARN.
|
453
580
|
#
|
454
581
|
def warn!: () -> Integer
|
455
582
|
|
456
|
-
#
|
457
|
-
#
|
583
|
+
# <!--
|
584
|
+
# rdoc-file=lib/logger.rb
|
585
|
+
# - warn?()
|
586
|
+
# -->
|
587
|
+
# Returns `true` if and only if the current severity level allows for the
|
588
|
+
# printing of `WARN` messages.
|
458
589
|
#
|
459
590
|
def warn?: () -> bool
|
460
591
|
|
461
592
|
private
|
462
593
|
|
594
|
+
# <!--
|
595
|
+
# rdoc-file=lib/logger.rb
|
596
|
+
# - format_message(severity, datetime, progname, msg)
|
597
|
+
# -->
|
598
|
+
#
|
463
599
|
def format_message: (String severity, Time datetime, untyped progname, untyped msg) -> _ToS
|
464
600
|
|
601
|
+
# <!--
|
602
|
+
# rdoc-file=lib/logger.rb
|
603
|
+
# - format_severity(severity)
|
604
|
+
# -->
|
605
|
+
#
|
465
606
|
def format_severity: (Integer severity) -> String
|
466
607
|
|
608
|
+
# <!--
|
609
|
+
# rdoc-file=lib/logger.rb
|
610
|
+
# - Logger.new(logdev, shift_age = 0, shift_size = 1048576)
|
611
|
+
# - Logger.new(logdev, shift_age = 'weekly')
|
612
|
+
# - Logger.new(logdev, level: :info)
|
613
|
+
# - Logger.new(logdev, progname: 'progname')
|
614
|
+
# - Logger.new(logdev, formatter: formatter)
|
615
|
+
# - Logger.new(logdev, datetime_format: '%Y-%m-%d %H:%M:%S')
|
616
|
+
# -->
|
467
617
|
# ### Args
|
468
618
|
#
|
469
619
|
# `logdev`
|
470
|
-
# : The log device. This is a filename (String)
|
471
|
-
# `STDOUT`, `STDERR`, or an open file)
|
620
|
+
# : The log device. This is a filename (String), IO object (typically
|
621
|
+
# `STDOUT`, `STDERR`, or an open file), `nil` (it writes nothing) or
|
622
|
+
# `File::NULL` (same as `nil`).
|
472
623
|
# `shift_age`
|
473
624
|
# : Number of old log files to keep, **or** frequency of rotation (`daily`,
|
474
625
|
# `weekly` or `monthly`). Default value is 0, which disables log file
|
@@ -500,6 +651,7 @@ end
|
|
500
651
|
|
501
652
|
Logger::ProgName: String
|
502
653
|
|
654
|
+
# <!-- rdoc-file=lib/logger.rb -->
|
503
655
|
# Severity label for logging (max 5 chars).
|
504
656
|
#
|
505
657
|
Logger::SEV_LABEL: Array[String]
|
data/stdlib/logger/0/period.rbs
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
module Logger::Period
|
2
|
+
# <!--
|
3
|
+
# rdoc-file=lib/logger/period.rb
|
4
|
+
# - next_rotate_time(now, shift_age)
|
5
|
+
# -->
|
6
|
+
#
|
2
7
|
def self?.next_rotate_time: (Time now, String shift_age) -> untyped
|
3
8
|
|
9
|
+
# <!--
|
10
|
+
# rdoc-file=lib/logger/period.rb
|
11
|
+
# - previous_period_end(now, shift_age)
|
12
|
+
# -->
|
13
|
+
#
|
4
14
|
def self?.previous_period_end: (Time now, String shift_age) -> untyped
|
5
15
|
|
6
16
|
SiD: Integer
|
@@ -1,8 +1,34 @@
|
|
1
|
+
# <!-- rdoc-file=lib/logger/severity.rb -->
|
2
|
+
# Logging severity.
|
3
|
+
#
|
1
4
|
module Logger::Severity
|
5
|
+
# <!-- rdoc-file=lib/logger/severity.rb -->
|
6
|
+
# Low-level information, mostly for developers.
|
7
|
+
#
|
2
8
|
DEBUG: 0
|
9
|
+
|
10
|
+
# <!-- rdoc-file=lib/logger/severity.rb -->
|
11
|
+
# Generic (useful) information about system operation.
|
12
|
+
#
|
3
13
|
INFO: 1
|
14
|
+
|
15
|
+
# <!-- rdoc-file=lib/logger/severity.rb -->
|
16
|
+
# A warning.
|
17
|
+
#
|
4
18
|
WARN: 2
|
19
|
+
|
20
|
+
# <!-- rdoc-file=lib/logger/severity.rb -->
|
21
|
+
# A handleable error condition.
|
22
|
+
#
|
5
23
|
ERROR: 3
|
24
|
+
|
25
|
+
# <!-- rdoc-file=lib/logger/severity.rb -->
|
26
|
+
# An unhandleable error that results in a program crash.
|
27
|
+
#
|
6
28
|
FATAL: 4
|
29
|
+
|
30
|
+
# <!-- rdoc-file=lib/logger/severity.rb -->
|
31
|
+
# An unknown message that should always be logged.
|
32
|
+
#
|
7
33
|
UNKNOWN: 5
|
8
34
|
end
|