capistrano-data_plane_api 0.1.4 → 0.2.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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -2
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +7 -4
  6. data/Gemfile.lock +108 -69
  7. data/README.md +5 -0
  8. data/capistrano-data_plane_api.gemspec +5 -2
  9. data/exe/cap_data_plane_api +3 -2
  10. data/lib/capistrano/data_plane_api/configuration/backend.rb +2 -0
  11. data/lib/capistrano/data_plane_api/configuration/server.rb +4 -2
  12. data/lib/capistrano/data_plane_api/configuration/symbol.rb +2 -0
  13. data/lib/capistrano/data_plane_api/configuration.rb +3 -3
  14. data/lib/capistrano/data_plane_api/deploy/args.rb +71 -40
  15. data/lib/capistrano/data_plane_api/deploy/deployment_stats.rb +29 -25
  16. data/lib/capistrano/data_plane_api/deploy/group.rb +33 -24
  17. data/lib/capistrano/data_plane_api/deploy/helper.rb +3 -5
  18. data/lib/capistrano/data_plane_api/deploy/server_stats.rb +60 -43
  19. data/lib/capistrano/data_plane_api/deploy.rb +3 -2
  20. data/lib/capistrano/data_plane_api/diggable.rb +5 -2
  21. data/lib/capistrano/data_plane_api/equatable.rb +4 -2
  22. data/lib/capistrano/data_plane_api/helper.rb +31 -27
  23. data/lib/capistrano/data_plane_api/hooks.rb +1 -0
  24. data/lib/capistrano/data_plane_api/show_state.rb +15 -12
  25. data/lib/capistrano/data_plane_api/tasks.rb +26 -2
  26. data/lib/capistrano/data_plane_api/terminal_print_loop.rb +7 -4
  27. data/lib/capistrano/data_plane_api/type.rb +9 -5
  28. data/lib/capistrano/data_plane_api/version.rb +2 -2
  29. data/lib/capistrano/data_plane_api.rb +96 -74
  30. data/lib/capistrano-data_plane_api.rb +4 -0
  31. data/rbi/capistrano-data_plane_api.rbi +283 -0
  32. data/sorbet/config +6 -0
  33. data/sorbet/rbi/annotations/.gitattributes +1 -0
  34. data/sorbet/rbi/annotations/faraday.rbi +17 -0
  35. data/sorbet/rbi/annotations/minitest.rbi +119 -0
  36. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  37. data/sorbet/rbi/annotations/webmock.rbi +9 -0
  38. data/sorbet/rbi/dsl/.gitattributes +1 -0
  39. data/sorbet/rbi/dsl/capistrano/data_plane_api/configuration/backend.rbi +50 -0
  40. data/sorbet/rbi/dsl/capistrano/data_plane_api/configuration/server.rbi +24 -0
  41. data/sorbet/rbi/dsl/capistrano/data_plane_api/configuration.rbi +52 -0
  42. data/sorbet/rbi/dsl/capistrano/data_plane_api/type.rbi +12 -0
  43. data/sorbet/rbi/gems/.gitattributes +1 -0
  44. data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
  45. data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
  46. data/sorbet/rbi/gems/base64@0.2.0.rbi +509 -0
  47. data/sorbet/rbi/gems/bigdecimal@3.1.9.rbi +8 -0
  48. data/sorbet/rbi/gems/booleans@0.1.3.rbi +28 -0
  49. data/sorbet/rbi/gems/byebug@12.0.0.rbi +37 -0
  50. data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
  51. data/sorbet/rbi/gems/data_plane_api@0.2.0.rbi +238 -0
  52. data/sorbet/rbi/gems/faraday-net_http@3.4.0.rbi +147 -0
  53. data/sorbet/rbi/gems/faraday@2.13.0.rbi +2974 -0
  54. data/sorbet/rbi/gems/hashdiff@1.1.2.rbi +353 -0
  55. data/sorbet/rbi/gems/json@2.10.2.rbi +2113 -0
  56. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +240 -0
  57. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  58. data/sorbet/rbi/gems/minitest@5.25.5.rbi +1547 -0
  59. data/sorbet/rbi/gems/net-http@0.6.0.rbi +4247 -0
  60. data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
  61. data/sorbet/rbi/gems/pastel@0.8.0.rbi +733 -0
  62. data/sorbet/rbi/gems/public_suffix@6.0.1.rbi +936 -0
  63. data/sorbet/rbi/gems/racc@1.8.1.rbi +160 -0
  64. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +404 -0
  65. data/sorbet/rbi/gems/rake@13.0.6.rbi +3030 -0
  66. data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
  67. data/sorbet/rbi/gems/rubocop-espago@1.1.8.rbi +9 -0
  68. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
  69. data/sorbet/rbi/gems/shale-builder@0.2.4.rbi +9 -0
  70. data/sorbet/rbi/gems/shale@1.2.2.rbi +2323 -0
  71. data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +563 -0
  72. data/sorbet/rbi/gems/strings-ansi@0.2.0.rbi +178 -0
  73. data/sorbet/rbi/gems/strings@0.2.1.rbi +830 -0
  74. data/sorbet/rbi/gems/thor@1.2.1.rbi +3957 -0
  75. data/sorbet/rbi/gems/tty-box@0.7.0.rbi +593 -0
  76. data/sorbet/rbi/gems/tty-color@0.6.0.rbi +241 -0
  77. data/sorbet/rbi/gems/tty-cursor@0.7.1.rbi +443 -0
  78. data/sorbet/rbi/gems/unicode-display_width@2.6.0.rbi +66 -0
  79. data/sorbet/rbi/gems/unicode_utils@1.4.0.rbi +184 -0
  80. data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
  81. data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
  82. data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
  83. data/sorbet/rbi/shims/gems/faraday.rbi +21 -0
  84. data/sorbet/rbi/shims/gems/shoulda-context@2.0.0.rbi +15 -0
  85. data/sorbet/rbi/todo.rbi +7 -0
  86. data/sorbet/tapioca/config.yml +28 -0
  87. data/sorbet/tapioca/extensions/load_gem.rb +1 -0
  88. data/sorbet/tapioca/require.rb +4 -0
  89. data/templates/bin/deploy.rb +1 -0
  90. metadata +106 -8
@@ -0,0 +1,963 @@
1
+ # typed: false
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `logger` gem.
5
+ # Please instead update this file by running `bin/tapioca gem logger`.
6
+
7
+
8
+ # \Class \Logger provides a simple but sophisticated logging utility that
9
+ # you can use to create one or more
10
+ # {event logs}[https://en.wikipedia.org/wiki/Logging_(software)#Event_logs]
11
+ # for your program.
12
+ # Each such log contains a chronological sequence of entries
13
+ # that provides a record of the program's activities.
14
+ #
15
+ # == About the Examples
16
+ #
17
+ # All examples on this page assume that \Logger has been required:
18
+ #
19
+ # require 'logger'
20
+ #
21
+ # == Synopsis
22
+ #
23
+ # Create a log with Logger.new:
24
+ #
25
+ # # Single log file.
26
+ # logger = Logger.new('t.log')
27
+ # # Size-based rotated logging: 3 10-megabyte files.
28
+ # logger = Logger.new('t.log', 3, 10485760)
29
+ # # Period-based rotated logging: daily (also allowed: 'weekly', 'monthly').
30
+ # logger = Logger.new('t.log', 'daily')
31
+ # # Log to an IO stream.
32
+ # logger = Logger.new($stdout)
33
+ #
34
+ # Add entries (level, message) with Logger#add:
35
+ #
36
+ # logger.add(Logger::DEBUG, 'Maximal debugging info')
37
+ # logger.add(Logger::INFO, 'Non-error information')
38
+ # logger.add(Logger::WARN, 'Non-error warning')
39
+ # logger.add(Logger::ERROR, 'Non-fatal error')
40
+ # logger.add(Logger::FATAL, 'Fatal error')
41
+ # logger.add(Logger::UNKNOWN, 'Most severe')
42
+ #
43
+ # Close the log with Logger#close:
44
+ #
45
+ # logger.close
46
+ #
47
+ # == Entries
48
+ #
49
+ # You can add entries with method Logger#add:
50
+ #
51
+ # logger.add(Logger::DEBUG, 'Maximal debugging info')
52
+ # logger.add(Logger::INFO, 'Non-error information')
53
+ # logger.add(Logger::WARN, 'Non-error warning')
54
+ # logger.add(Logger::ERROR, 'Non-fatal error')
55
+ # logger.add(Logger::FATAL, 'Fatal error')
56
+ # logger.add(Logger::UNKNOWN, 'Most severe')
57
+ #
58
+ # These shorthand methods also add entries:
59
+ #
60
+ # logger.debug('Maximal debugging info')
61
+ # logger.info('Non-error information')
62
+ # logger.warn('Non-error warning')
63
+ # logger.error('Non-fatal error')
64
+ # logger.fatal('Fatal error')
65
+ # logger.unknown('Most severe')
66
+ #
67
+ # When you call any of these methods,
68
+ # the entry may or may not be written to the log,
69
+ # depending on the entry's severity and on the log level;
70
+ # see {Log Level}[rdoc-ref:Logger@Log+Level]
71
+ #
72
+ # An entry always has:
73
+ #
74
+ # - A severity (the required argument to #add).
75
+ # - An automatically created timestamp.
76
+ #
77
+ # And may also have:
78
+ #
79
+ # - A message.
80
+ # - A program name.
81
+ #
82
+ # Example:
83
+ #
84
+ # logger = Logger.new($stdout)
85
+ # logger.add(Logger::INFO, 'My message.', 'mung')
86
+ # # => I, [2022-05-07T17:21:46.536234 #20536] INFO -- mung: My message.
87
+ #
88
+ # The default format for an entry is:
89
+ #
90
+ # "%s, [%s #%d] %5s -- %s: %s\n"
91
+ #
92
+ # where the values to be formatted are:
93
+ #
94
+ # - \Severity (one letter).
95
+ # - Timestamp.
96
+ # - Process id.
97
+ # - \Severity (word).
98
+ # - Program name.
99
+ # - Message.
100
+ #
101
+ # You can use a different entry format by:
102
+ #
103
+ # - Setting a custom format proc (affects following entries);
104
+ # see {formatter=}[Logger.html#attribute-i-formatter].
105
+ # - Calling any of the methods above with a block
106
+ # (affects only the one entry).
107
+ # Doing so can have two benefits:
108
+ #
109
+ # - Context: the block can evaluate the entire program context
110
+ # and create a context-dependent message.
111
+ # - Performance: the block is not evaluated unless the log level
112
+ # permits the entry actually to be written:
113
+ #
114
+ # logger.error { my_slow_message_generator }
115
+ #
116
+ # Contrast this with the string form, where the string is
117
+ # always evaluated, regardless of the log level:
118
+ #
119
+ # logger.error("#{my_slow_message_generator}")
120
+ #
121
+ # === \Severity
122
+ #
123
+ # The severity of a log entry has two effects:
124
+ #
125
+ # - Determines whether the entry is selected for inclusion in the log;
126
+ # see {Log Level}[rdoc-ref:Logger@Log+Level].
127
+ # - Indicates to any log reader (whether a person or a program)
128
+ # the relative importance of the entry.
129
+ #
130
+ # === Timestamp
131
+ #
132
+ # The timestamp for a log entry is generated automatically
133
+ # when the entry is created.
134
+ #
135
+ # The logged timestamp is formatted by method
136
+ # {Time#strftime}[https://docs.ruby-lang.org/en/master/Time.html#method-i-strftime]
137
+ # using this format string:
138
+ #
139
+ # '%Y-%m-%dT%H:%M:%S.%6N'
140
+ #
141
+ # Example:
142
+ #
143
+ # logger = Logger.new($stdout)
144
+ # logger.add(Logger::INFO)
145
+ # # => I, [2022-05-07T17:04:32.318331 #20536] INFO -- : nil
146
+ #
147
+ # You can set a different format using method #datetime_format=.
148
+ #
149
+ # === Message
150
+ #
151
+ # The message is an optional argument to an entry method:
152
+ #
153
+ # logger = Logger.new($stdout)
154
+ # logger.add(Logger::INFO, 'My message')
155
+ # # => I, [2022-05-07T18:15:37.647581 #20536] INFO -- : My message
156
+ #
157
+ # For the default entry formatter, <tt>Logger::Formatter</tt>,
158
+ # the message object may be:
159
+ #
160
+ # - A string: used as-is.
161
+ # - An Exception: <tt>message.message</tt> is used.
162
+ # - Anything else: <tt>message.inspect</tt> is used.
163
+ #
164
+ # *Note*: Logger::Formatter does not escape or sanitize
165
+ # the message passed to it.
166
+ # Developers should be aware that malicious data (user input)
167
+ # may be in the message, and should explicitly escape untrusted data.
168
+ #
169
+ # You can use a custom formatter to escape message data;
170
+ # see the example at {formatter=}[Logger.html#attribute-i-formatter].
171
+ #
172
+ # === Program Name
173
+ #
174
+ # The program name is an optional argument to an entry method:
175
+ #
176
+ # logger = Logger.new($stdout)
177
+ # logger.add(Logger::INFO, 'My message', 'mung')
178
+ # # => I, [2022-05-07T18:17:38.084716 #20536] INFO -- mung: My message
179
+ #
180
+ # The default program name for a new logger may be set in the call to
181
+ # Logger.new via optional keyword argument +progname+:
182
+ #
183
+ # logger = Logger.new('t.log', progname: 'mung')
184
+ #
185
+ # The default program name for an existing logger may be set
186
+ # by a call to method #progname=:
187
+ #
188
+ # logger.progname = 'mung'
189
+ #
190
+ # The current program name may be retrieved with method
191
+ # {progname}[Logger.html#attribute-i-progname]:
192
+ #
193
+ # logger.progname # => "mung"
194
+ #
195
+ # == Log Level
196
+ #
197
+ # The log level setting determines whether an entry is actually
198
+ # written to the log, based on the entry's severity.
199
+ #
200
+ # These are the defined severities (least severe to most severe):
201
+ #
202
+ # logger = Logger.new($stdout)
203
+ # logger.add(Logger::DEBUG, 'Maximal debugging info')
204
+ # # => D, [2022-05-07T17:57:41.776220 #20536] DEBUG -- : Maximal debugging info
205
+ # logger.add(Logger::INFO, 'Non-error information')
206
+ # # => I, [2022-05-07T17:59:14.349167 #20536] INFO -- : Non-error information
207
+ # logger.add(Logger::WARN, 'Non-error warning')
208
+ # # => W, [2022-05-07T18:00:45.337538 #20536] WARN -- : Non-error warning
209
+ # logger.add(Logger::ERROR, 'Non-fatal error')
210
+ # # => E, [2022-05-07T18:02:41.592912 #20536] ERROR -- : Non-fatal error
211
+ # logger.add(Logger::FATAL, 'Fatal error')
212
+ # # => F, [2022-05-07T18:05:24.703931 #20536] FATAL -- : Fatal error
213
+ # logger.add(Logger::UNKNOWN, 'Most severe')
214
+ # # => A, [2022-05-07T18:07:54.657491 #20536] ANY -- : Most severe
215
+ #
216
+ # The default initial level setting is Logger::DEBUG, the lowest level,
217
+ # which means that all entries are to be written, regardless of severity:
218
+ #
219
+ # logger = Logger.new($stdout)
220
+ # logger.level # => 0
221
+ # logger.add(0, "My message")
222
+ # # => D, [2022-05-11T15:10:59.773668 #20536] DEBUG -- : My message
223
+ #
224
+ # You can specify a different setting in a new logger
225
+ # using keyword argument +level+ with an appropriate value:
226
+ #
227
+ # logger = Logger.new($stdout, level: Logger::ERROR)
228
+ # logger = Logger.new($stdout, level: 'error')
229
+ # logger = Logger.new($stdout, level: :error)
230
+ # logger.level # => 3
231
+ #
232
+ # With this level, entries with severity Logger::ERROR and higher
233
+ # are written, while those with lower severities are not written:
234
+ #
235
+ # logger = Logger.new($stdout, level: Logger::ERROR)
236
+ # logger.add(3)
237
+ # # => E, [2022-05-11T15:17:20.933362 #20536] ERROR -- : nil
238
+ # logger.add(2) # Silent.
239
+ #
240
+ # You can set the log level for an existing logger
241
+ # with method #level=:
242
+ #
243
+ # logger.level = Logger::ERROR
244
+ #
245
+ # These shorthand methods also set the level:
246
+ #
247
+ # logger.debug! # => 0
248
+ # logger.info! # => 1
249
+ # logger.warn! # => 2
250
+ # logger.error! # => 3
251
+ # logger.fatal! # => 4
252
+ #
253
+ # You can retrieve the log level with method #level.
254
+ #
255
+ # logger.level = Logger::ERROR
256
+ # logger.level # => 3
257
+ #
258
+ # These methods return whether a given
259
+ # level is to be written:
260
+ #
261
+ # logger.level = Logger::ERROR
262
+ # logger.debug? # => false
263
+ # logger.info? # => false
264
+ # logger.warn? # => false
265
+ # logger.error? # => true
266
+ # logger.fatal? # => true
267
+ #
268
+ # == Log File Rotation
269
+ #
270
+ # By default, a log file is a single file that grows indefinitely
271
+ # (until explicitly closed); there is no file rotation.
272
+ #
273
+ # To keep log files to a manageable size,
274
+ # you can use _log_ _file_ _rotation_, which uses multiple log files:
275
+ #
276
+ # - Each log file has entries for a non-overlapping
277
+ # time interval.
278
+ # - Only the most recent log file is open and active;
279
+ # the others are closed and inactive.
280
+ #
281
+ # === Size-Based Rotation
282
+ #
283
+ # For size-based log file rotation, call Logger.new with:
284
+ #
285
+ # - Argument +logdev+ as a file path.
286
+ # - Argument +shift_age+ with a positive integer:
287
+ # the number of log files to be in the rotation.
288
+ # - Argument +shift_size+ as a positive integer:
289
+ # the maximum size (in bytes) of each log file;
290
+ # defaults to 1048576 (1 megabyte).
291
+ #
292
+ # Examples:
293
+ #
294
+ # logger = Logger.new('t.log', 3) # Three 1-megabyte files.
295
+ # logger = Logger.new('t.log', 5, 10485760) # Five 10-megabyte files.
296
+ #
297
+ # For these examples, suppose:
298
+ #
299
+ # logger = Logger.new('t.log', 3)
300
+ #
301
+ # Logging begins in the new log file, +t.log+;
302
+ # the log file is "full" and ready for rotation
303
+ # when a new entry would cause its size to exceed +shift_size+.
304
+ #
305
+ # The first time +t.log+ is full:
306
+ #
307
+ # - +t.log+ is closed and renamed to +t.log.0+.
308
+ # - A new file +t.log+ is opened.
309
+ #
310
+ # The second time +t.log+ is full:
311
+ #
312
+ # - +t.log.0 is renamed as +t.log.1+.
313
+ # - +t.log+ is closed and renamed to +t.log.0+.
314
+ # - A new file +t.log+ is opened.
315
+ #
316
+ # Each subsequent time that +t.log+ is full,
317
+ # the log files are rotated:
318
+ #
319
+ # - +t.log.1+ is removed.
320
+ # - +t.log.0 is renamed as +t.log.1+.
321
+ # - +t.log+ is closed and renamed to +t.log.0+.
322
+ # - A new file +t.log+ is opened.
323
+ #
324
+ # === Periodic Rotation
325
+ #
326
+ # For periodic rotation, call Logger.new with:
327
+ #
328
+ # - Argument +logdev+ as a file path.
329
+ # - Argument +shift_age+ as a string period indicator.
330
+ #
331
+ # Examples:
332
+ #
333
+ # logger = Logger.new('t.log', 'daily') # Rotate log files daily.
334
+ # logger = Logger.new('t.log', 'weekly') # Rotate log files weekly.
335
+ # logger = Logger.new('t.log', 'monthly') # Rotate log files monthly.
336
+ #
337
+ # Example:
338
+ #
339
+ # logger = Logger.new('t.log', 'daily')
340
+ #
341
+ # When the given period expires:
342
+ #
343
+ # - The base log file, +t.log+ is closed and renamed
344
+ # with a date-based suffix such as +t.log.20220509+.
345
+ # - A new log file +t.log+ is opened.
346
+ # - Nothing is removed.
347
+ #
348
+ # The default format for the suffix is <tt>'%Y%m%d'</tt>,
349
+ # which produces a suffix similar to the one above.
350
+ # You can set a different format using create-time option
351
+ # +shift_period_suffix+;
352
+ # see details and suggestions at
353
+ # {Time#strftime}[https://docs.ruby-lang.org/en/master/Time.html#method-i-strftime].
354
+ #
355
+ # source://logger//lib/logger/version.rb#3
356
+ class Logger
357
+ include ::Logger::Severity
358
+
359
+ # :call-seq:
360
+ # Logger.new(logdev, shift_age = 0, shift_size = 1048576, **options)
361
+ #
362
+ # With the single argument +logdev+,
363
+ # returns a new logger with all default options:
364
+ #
365
+ # Logger.new('t.log') # => #<Logger:0x000001e685dc6ac8>
366
+ #
367
+ # Argument +logdev+ must be one of:
368
+ #
369
+ # - A string filepath: entries are to be written
370
+ # to the file at that path; if the file at that path exists,
371
+ # new entries are appended.
372
+ # - An IO stream (typically <tt>$stdout</tt>, <tt>$stderr</tt>. or
373
+ # an open file): entries are to be written to the given stream.
374
+ # - +nil+ or +File::NULL+: no entries are to be written.
375
+ #
376
+ # Argument +shift_age+ must be one of:
377
+ #
378
+ # - The number of log files to be in the rotation.
379
+ # See {Size-Based Rotation}[rdoc-ref:Logger@Size-Based+Rotation].
380
+ # - A string period indicator.
381
+ # See {Periodic Rotation}[rdoc-ref:Logger@Periodic+Rotation].
382
+ #
383
+ # Argument +shift_size+ is the maximum size (in bytes) of each log file.
384
+ # See {Size-Based Rotation}[rdoc-ref:Logger@Size-Based+Rotation].
385
+ #
386
+ # Examples:
387
+ #
388
+ # Logger.new('t.log')
389
+ # Logger.new($stdout)
390
+ #
391
+ # The keyword options are:
392
+ #
393
+ # - +level+: sets the log level; default value is Logger::DEBUG.
394
+ # See {Log Level}[rdoc-ref:Logger@Log+Level]:
395
+ #
396
+ # Logger.new('t.log', level: Logger::ERROR)
397
+ #
398
+ # - +progname+: sets the default program name; default is +nil+.
399
+ # See {Program Name}[rdoc-ref:Logger@Program+Name]:
400
+ #
401
+ # Logger.new('t.log', progname: 'mung')
402
+ #
403
+ # - +formatter+: sets the entry formatter; default is +nil+.
404
+ # See {formatter=}[Logger.html#attribute-i-formatter].
405
+ #
406
+ # - +datetime_format+: sets the format for entry timestamp;
407
+ # default is +nil+.
408
+ # See #datetime_format=.
409
+ #
410
+ # - +binmode+: sets whether the logger writes in binary mode;
411
+ # default is +false+.
412
+ #
413
+ # - +shift_period_suffix+: sets the format for the filename suffix
414
+ # for periodic log file rotation; default is <tt>'%Y%m%d'</tt>.
415
+ # See {Periodic Rotation}[rdoc-ref:Logger@Periodic+Rotation].
416
+ #
417
+ # - +reraise_write_errors+: An array of exception classes, which will
418
+ # be reraised if there is an error when writing to the log device.
419
+ # The default is to swallow all exceptions raised.
420
+ # - +skip_header+: If +true+, prevents the logger from writing a header
421
+ # when creating a new log file. The default is +false+, meaning
422
+ # the header will be written as usual.
423
+ #
424
+ # @return [Logger] a new instance of Logger
425
+ #
426
+ # source://logger//lib/logger.rb#598
427
+ def initialize(logdev, shift_age = T.unsafe(nil), shift_size = T.unsafe(nil), level: T.unsafe(nil), progname: T.unsafe(nil), formatter: T.unsafe(nil), datetime_format: T.unsafe(nil), binmode: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), reraise_write_errors: T.unsafe(nil), skip_header: T.unsafe(nil)); end
428
+
429
+ # Writes the given +msg+ to the log with no formatting;
430
+ # returns the number of characters written,
431
+ # or +nil+ if no log device exists:
432
+ #
433
+ # logger = Logger.new($stdout)
434
+ # logger << 'My message.' # => 10
435
+ #
436
+ # Output:
437
+ #
438
+ # My message.
439
+ #
440
+ # source://logger//lib/logger.rb#708
441
+ def <<(msg); end
442
+
443
+ # Creates a log entry, which may or may not be written to the log,
444
+ # depending on the entry's severity and on the log level.
445
+ # See {Log Level}[rdoc-ref:Logger@Log+Level]
446
+ # and {Entries}[rdoc-ref:Logger@Entries] for details.
447
+ #
448
+ # Examples:
449
+ #
450
+ # logger = Logger.new($stdout, progname: 'mung')
451
+ # logger.add(Logger::INFO)
452
+ # logger.add(Logger::ERROR, 'No good')
453
+ # logger.add(Logger::ERROR, 'No good', 'gnum')
454
+ #
455
+ # Output:
456
+ #
457
+ # I, [2022-05-12T16:25:31.469726 #36328] INFO -- mung: mung
458
+ # E, [2022-05-12T16:25:55.349414 #36328] ERROR -- mung: No good
459
+ # E, [2022-05-12T16:26:35.841134 #36328] ERROR -- gnum: No good
460
+ #
461
+ # These convenience methods have implicit severity:
462
+ #
463
+ # - #debug.
464
+ # - #info.
465
+ # - #warn.
466
+ # - #error.
467
+ # - #fatal.
468
+ # - #unknown.
469
+ #
470
+ # source://logger//lib/logger.rb#675
471
+ def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil)); end
472
+
473
+ # Closes the logger; returns +nil+:
474
+ #
475
+ # logger = Logger.new('t.log')
476
+ # logger.close # => nil
477
+ # logger.info('foo') # Prints "log writing failed. closed stream"
478
+ #
479
+ # Related: Logger#reopen.
480
+ #
481
+ # source://logger//lib/logger.rb#755
482
+ def close; end
483
+
484
+ # Returns the date-time format; see #datetime_format=.
485
+ #
486
+ # source://logger//lib/logger.rb#438
487
+ def datetime_format; end
488
+
489
+ # Sets the date-time format.
490
+ #
491
+ # Argument +datetime_format+ should be either of these:
492
+ #
493
+ # - A string suitable for use as a format for method
494
+ # {Time#strftime}[https://docs.ruby-lang.org/en/master/Time.html#method-i-strftime].
495
+ # - +nil+: the logger uses <tt>'%Y-%m-%dT%H:%M:%S.%6N'</tt>.
496
+ #
497
+ # source://logger//lib/logger.rb#432
498
+ def datetime_format=(datetime_format); end
499
+
500
+ # Equivalent to calling #add with severity <tt>Logger::DEBUG</tt>.
501
+ #
502
+ # source://logger//lib/logger.rb#714
503
+ def debug(progname = T.unsafe(nil), &block); end
504
+
505
+ # Sets the log level to Logger::DEBUG.
506
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
507
+ #
508
+ # source://logger//lib/logger.rb#487
509
+ def debug!; end
510
+
511
+ # Returns +true+ if the log level allows entries with severity
512
+ # Logger::DEBUG to be written, +false+ otherwise.
513
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
514
+ #
515
+ # @return [Boolean]
516
+ #
517
+ # source://logger//lib/logger.rb#482
518
+ def debug?; end
519
+
520
+ # Equivalent to calling #add with severity <tt>Logger::ERROR</tt>.
521
+ #
522
+ # source://logger//lib/logger.rb#732
523
+ def error(progname = T.unsafe(nil), &block); end
524
+
525
+ # Sets the log level to Logger::ERROR.
526
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
527
+ #
528
+ # source://logger//lib/logger.rb#520
529
+ def error!; end
530
+
531
+ # Returns +true+ if the log level allows entries with severity
532
+ # Logger::ERROR to be written, +false+ otherwise.
533
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
534
+ #
535
+ # @return [Boolean]
536
+ #
537
+ # source://logger//lib/logger.rb#515
538
+ def error?; end
539
+
540
+ # Equivalent to calling #add with severity <tt>Logger::FATAL</tt>.
541
+ #
542
+ # source://logger//lib/logger.rb#738
543
+ def fatal(progname = T.unsafe(nil), &block); end
544
+
545
+ # Sets the log level to Logger::FATAL.
546
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
547
+ #
548
+ # source://logger//lib/logger.rb#531
549
+ def fatal!; end
550
+
551
+ # Returns +true+ if the log level allows entries with severity
552
+ # Logger::FATAL to be written, +false+ otherwise.
553
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
554
+ #
555
+ # @return [Boolean]
556
+ #
557
+ # source://logger//lib/logger.rb#526
558
+ def fatal?; end
559
+
560
+ # Sets or retrieves the logger entry formatter proc.
561
+ #
562
+ # When +formatter+ is +nil+, the logger uses Logger::Formatter.
563
+ #
564
+ # When +formatter+ is a proc, a new entry is formatted by the proc,
565
+ # which is called with four arguments:
566
+ #
567
+ # - +severity+: The severity of the entry.
568
+ # - +time+: A Time object representing the entry's timestamp.
569
+ # - +progname+: The program name for the entry.
570
+ # - +msg+: The message for the entry (string or string-convertible object).
571
+ #
572
+ # The proc should return a string containing the formatted entry.
573
+ #
574
+ # This custom formatter uses
575
+ # {String#dump}[https://docs.ruby-lang.org/en/master/String.html#method-i-dump]
576
+ # to escape the message string:
577
+ #
578
+ # logger = Logger.new($stdout, progname: 'mung')
579
+ # original_formatter = logger.formatter || Logger::Formatter.new
580
+ # logger.formatter = proc { |severity, time, progname, msg|
581
+ # original_formatter.call(severity, time, progname, msg.dump)
582
+ # }
583
+ # logger.add(Logger::INFO, "hello \n ''")
584
+ # logger.add(Logger::INFO, "\f\x00\xff\\\"")
585
+ #
586
+ # Output:
587
+ #
588
+ # I, [2022-05-13T13:16:29.637488 #8492] INFO -- mung: "hello \n ''"
589
+ # I, [2022-05-13T13:16:29.637610 #8492] INFO -- mung: "\f\x00\xFF\\\""
590
+ #
591
+ # source://logger//lib/logger.rb#473
592
+ def formatter; end
593
+
594
+ # Sets or retrieves the logger entry formatter proc.
595
+ #
596
+ # When +formatter+ is +nil+, the logger uses Logger::Formatter.
597
+ #
598
+ # When +formatter+ is a proc, a new entry is formatted by the proc,
599
+ # which is called with four arguments:
600
+ #
601
+ # - +severity+: The severity of the entry.
602
+ # - +time+: A Time object representing the entry's timestamp.
603
+ # - +progname+: The program name for the entry.
604
+ # - +msg+: The message for the entry (string or string-convertible object).
605
+ #
606
+ # The proc should return a string containing the formatted entry.
607
+ #
608
+ # This custom formatter uses
609
+ # {String#dump}[https://docs.ruby-lang.org/en/master/String.html#method-i-dump]
610
+ # to escape the message string:
611
+ #
612
+ # logger = Logger.new($stdout, progname: 'mung')
613
+ # original_formatter = logger.formatter || Logger::Formatter.new
614
+ # logger.formatter = proc { |severity, time, progname, msg|
615
+ # original_formatter.call(severity, time, progname, msg.dump)
616
+ # }
617
+ # logger.add(Logger::INFO, "hello \n ''")
618
+ # logger.add(Logger::INFO, "\f\x00\xff\\\"")
619
+ #
620
+ # Output:
621
+ #
622
+ # I, [2022-05-13T13:16:29.637488 #8492] INFO -- mung: "hello \n ''"
623
+ # I, [2022-05-13T13:16:29.637610 #8492] INFO -- mung: "\f\x00\xFF\\\""
624
+ #
625
+ # source://logger//lib/logger.rb#473
626
+ def formatter=(_arg0); end
627
+
628
+ # Equivalent to calling #add with severity <tt>Logger::INFO</tt>.
629
+ #
630
+ # source://logger//lib/logger.rb#720
631
+ def info(progname = T.unsafe(nil), &block); end
632
+
633
+ # Sets the log level to Logger::INFO.
634
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
635
+ #
636
+ # source://logger//lib/logger.rb#498
637
+ def info!; end
638
+
639
+ # Returns +true+ if the log level allows entries with severity
640
+ # Logger::INFO to be written, +false+ otherwise.
641
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
642
+ #
643
+ # @return [Boolean]
644
+ #
645
+ # source://logger//lib/logger.rb#493
646
+ def info?; end
647
+
648
+ # Logging severity threshold (e.g. <tt>Logger::INFO</tt>).
649
+ #
650
+ # source://logger//lib/logger.rb#383
651
+ def level; end
652
+
653
+ # Sets the log level; returns +severity+.
654
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
655
+ #
656
+ # Argument +severity+ may be an integer, a string, or a symbol:
657
+ #
658
+ # logger.level = Logger::ERROR # => 3
659
+ # logger.level = 3 # => 3
660
+ # logger.level = 'error' # => "error"
661
+ # logger.level = :error # => :error
662
+ #
663
+ # Logger#sev_threshold= is an alias for Logger#level=.
664
+ #
665
+ # source://logger//lib/logger.rb#399
666
+ def level=(severity); end
667
+
668
+ # Creates a log entry, which may or may not be written to the log,
669
+ # depending on the entry's severity and on the log level.
670
+ # See {Log Level}[rdoc-ref:Logger@Log+Level]
671
+ # and {Entries}[rdoc-ref:Logger@Entries] for details.
672
+ #
673
+ # Examples:
674
+ #
675
+ # logger = Logger.new($stdout, progname: 'mung')
676
+ # logger.add(Logger::INFO)
677
+ # logger.add(Logger::ERROR, 'No good')
678
+ # logger.add(Logger::ERROR, 'No good', 'gnum')
679
+ #
680
+ # Output:
681
+ #
682
+ # I, [2022-05-12T16:25:31.469726 #36328] INFO -- mung: mung
683
+ # E, [2022-05-12T16:25:55.349414 #36328] ERROR -- mung: No good
684
+ # E, [2022-05-12T16:26:35.841134 #36328] ERROR -- gnum: No good
685
+ #
686
+ # These convenience methods have implicit severity:
687
+ #
688
+ # - #debug.
689
+ # - #info.
690
+ # - #warn.
691
+ # - #error.
692
+ # - #fatal.
693
+ # - #unknown.
694
+ #
695
+ # source://logger//lib/logger.rb#675
696
+ def log(severity, message = T.unsafe(nil), progname = T.unsafe(nil)); end
697
+
698
+ # Program name to include in log messages.
699
+ #
700
+ # source://logger//lib/logger.rb#422
701
+ def progname; end
702
+
703
+ # Program name to include in log messages.
704
+ #
705
+ # source://logger//lib/logger.rb#422
706
+ def progname=(_arg0); end
707
+
708
+ # Sets the logger's output stream:
709
+ #
710
+ # - If +logdev+ is +nil+, reopens the current output stream.
711
+ # - If +logdev+ is a filepath, opens the indicated file for append.
712
+ # - If +logdev+ is an IO stream
713
+ # (usually <tt>$stdout</tt>, <tt>$stderr</tt>, or an open File object),
714
+ # opens the stream for append.
715
+ #
716
+ # Example:
717
+ #
718
+ # logger = Logger.new('t.log')
719
+ # logger.add(Logger::ERROR, 'one')
720
+ # logger.close
721
+ # logger.add(Logger::ERROR, 'two') # Prints 'log writing failed. closed stream'
722
+ # logger.reopen
723
+ # logger.add(Logger::ERROR, 'three')
724
+ # logger.close
725
+ # File.readlines('t.log')
726
+ # # =>
727
+ # # ["# Logfile created on 2022-05-12 14:21:19 -0500 by logger.rb/v1.5.0\n",
728
+ # # "E, [2022-05-12T14:21:27.596726 #22428] ERROR -- : one\n",
729
+ # # "E, [2022-05-12T14:23:05.847241 #22428] ERROR -- : three\n"]
730
+ #
731
+ # source://logger//lib/logger.rb#642
732
+ def reopen(logdev = T.unsafe(nil), shift_age = T.unsafe(nil), shift_size = T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil)); end
733
+
734
+ # Logging severity threshold (e.g. <tt>Logger::INFO</tt>).
735
+ #
736
+ # source://logger//lib/logger.rb#383
737
+ def sev_threshold; end
738
+
739
+ # Sets the log level; returns +severity+.
740
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
741
+ #
742
+ # Argument +severity+ may be an integer, a string, or a symbol:
743
+ #
744
+ # logger.level = Logger::ERROR # => 3
745
+ # logger.level = 3 # => 3
746
+ # logger.level = 'error' # => "error"
747
+ # logger.level = :error # => :error
748
+ #
749
+ # Logger#sev_threshold= is an alias for Logger#level=.
750
+ #
751
+ # source://logger//lib/logger.rb#399
752
+ def sev_threshold=(severity); end
753
+
754
+ # Equivalent to calling #add with severity <tt>Logger::UNKNOWN</tt>.
755
+ #
756
+ # source://logger//lib/logger.rb#744
757
+ def unknown(progname = T.unsafe(nil), &block); end
758
+
759
+ # Equivalent to calling #add with severity <tt>Logger::WARN</tt>.
760
+ #
761
+ # source://logger//lib/logger.rb#726
762
+ def warn(progname = T.unsafe(nil), &block); end
763
+
764
+ # Sets the log level to Logger::WARN.
765
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
766
+ #
767
+ # source://logger//lib/logger.rb#509
768
+ def warn!; end
769
+
770
+ # Returns +true+ if the log level allows entries with severity
771
+ # Logger::WARN to be written, +false+ otherwise.
772
+ # See {Log Level}[rdoc-ref:Logger@Log+Level].
773
+ #
774
+ # @return [Boolean]
775
+ #
776
+ # source://logger//lib/logger.rb#504
777
+ def warn?; end
778
+
779
+ # Adjust the log level during the block execution for the current Fiber only
780
+ #
781
+ # logger.with_level(:debug) do
782
+ # logger.debug { "Hello" }
783
+ # end
784
+ #
785
+ # source://logger//lib/logger.rb#408
786
+ def with_level(severity); end
787
+
788
+ private
789
+
790
+ # source://logger//lib/logger.rb#786
791
+ def format_message(severity, datetime, progname, msg); end
792
+
793
+ # source://logger//lib/logger.rb#764
794
+ def format_severity(severity); end
795
+
796
+ # source://logger//lib/logger.rb#782
797
+ def level_key; end
798
+
799
+ # Guarantee the existence of this ivar even when subclasses don't call the superclass constructor.
800
+ #
801
+ # source://logger//lib/logger.rb#769
802
+ def level_override; end
803
+ end
804
+
805
+ # Default formatter for log messages.
806
+ #
807
+ # source://logger//lib/logger/formatter.rb#5
808
+ class Logger::Formatter
809
+ # @return [Formatter] a new instance of Formatter
810
+ #
811
+ # source://logger//lib/logger/formatter.rb#11
812
+ def initialize; end
813
+
814
+ # source://logger//lib/logger/formatter.rb#15
815
+ def call(severity, time, progname, msg); end
816
+
817
+ # Returns the value of attribute datetime_format.
818
+ #
819
+ # source://logger//lib/logger/formatter.rb#9
820
+ def datetime_format; end
821
+
822
+ # Sets the attribute datetime_format
823
+ #
824
+ # @param value the value to set the attribute datetime_format to.
825
+ #
826
+ # source://logger//lib/logger/formatter.rb#9
827
+ def datetime_format=(_arg0); end
828
+
829
+ private
830
+
831
+ # source://logger//lib/logger/formatter.rb#21
832
+ def format_datetime(time); end
833
+
834
+ # source://logger//lib/logger/formatter.rb#25
835
+ def msg2str(msg); end
836
+ end
837
+
838
+ # source://logger//lib/logger/formatter.rb#7
839
+ Logger::Formatter::DatetimeFormat = T.let(T.unsafe(nil), String)
840
+
841
+ # source://logger//lib/logger/formatter.rb#6
842
+ Logger::Formatter::Format = T.let(T.unsafe(nil), String)
843
+
844
+ # Device used for logging messages.
845
+ #
846
+ # source://logger//lib/logger/log_device.rb#7
847
+ class Logger::LogDevice
848
+ include ::Logger::Period
849
+ include ::MonitorMixin
850
+
851
+ # @return [LogDevice] a new instance of LogDevice
852
+ #
853
+ # source://logger//lib/logger/log_device.rb#14
854
+ def initialize(log = T.unsafe(nil), shift_age: T.unsafe(nil), shift_size: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil), reraise_write_errors: T.unsafe(nil), skip_header: T.unsafe(nil)); end
855
+
856
+ # source://logger//lib/logger/log_device.rb#38
857
+ def close; end
858
+
859
+ # Returns the value of attribute dev.
860
+ #
861
+ # source://logger//lib/logger/log_device.rb#10
862
+ def dev; end
863
+
864
+ # Returns the value of attribute filename.
865
+ #
866
+ # source://logger//lib/logger/log_device.rb#11
867
+ def filename; end
868
+
869
+ # source://logger//lib/logger/log_device.rb#48
870
+ def reopen(log = T.unsafe(nil), shift_age: T.unsafe(nil), shift_size: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil)); end
871
+
872
+ # source://logger//lib/logger/log_device.rb#27
873
+ def write(message); end
874
+
875
+ private
876
+
877
+ # source://logger//lib/logger/log_device.rb#156
878
+ def add_log_header(file); end
879
+
880
+ # source://logger//lib/logger/log_device.rb#162
881
+ def check_shift_log; end
882
+
883
+ # source://logger//lib/logger/log_device.rb#132
884
+ def create_logfile(filename); end
885
+
886
+ # source://logger//lib/logger/log_device.rb#104
887
+ def fixup_mode(dev); end
888
+
889
+ # source://logger//lib/logger/log_device.rb#148
890
+ def handle_write_errors(mesg); end
891
+
892
+ # source://logger//lib/logger/log_device.rb#177
893
+ def lock_shift_log; end
894
+
895
+ # source://logger//lib/logger/log_device.rb#119
896
+ def open_logfile(filename); end
897
+
898
+ # source://logger//lib/logger/log_device.rb#78
899
+ def set_dev(log); end
900
+
901
+ # source://logger//lib/logger/log_device.rb#92
902
+ def set_file(shift_age, shift_size, shift_period_suffix); end
903
+
904
+ # source://logger//lib/logger/log_device.rb#207
905
+ def shift_log_age; end
906
+
907
+ # source://logger//lib/logger/log_device.rb#232
908
+ def shift_log_file(shifted); end
909
+
910
+ # source://logger//lib/logger/log_device.rb#216
911
+ def shift_log_period(period_end); end
912
+ end
913
+
914
+ # :stopdoc:
915
+ #
916
+ # source://logger//lib/logger/log_device.rb#69
917
+ Logger::LogDevice::MODE = T.let(T.unsafe(nil), Integer)
918
+
919
+ # source://logger//lib/logger/log_device.rb#76
920
+ Logger::LogDevice::MODE_TO_CREATE = T.let(T.unsafe(nil), Integer)
921
+
922
+ # source://logger//lib/logger/log_device.rb#72
923
+ Logger::LogDevice::MODE_TO_OPEN = T.let(T.unsafe(nil), Integer)
924
+
925
+ # source://logger//lib/logger/period.rb#4
926
+ module Logger::Period
927
+ private
928
+
929
+ # source://logger//lib/logger/period.rb#9
930
+ def next_rotate_time(now, shift_age); end
931
+
932
+ # source://logger//lib/logger/period.rb#31
933
+ def previous_period_end(now, shift_age); end
934
+
935
+ class << self
936
+ # source://logger//lib/logger/period.rb#9
937
+ def next_rotate_time(now, shift_age); end
938
+
939
+ # source://logger//lib/logger/period.rb#31
940
+ def previous_period_end(now, shift_age); end
941
+ end
942
+ end
943
+
944
+ # source://logger//lib/logger/period.rb#7
945
+ Logger::Period::SiD = T.let(T.unsafe(nil), Integer)
946
+
947
+ # \Severity label for logging (max 5 chars).
948
+ #
949
+ # source://logger//lib/logger.rb#762
950
+ Logger::SEV_LABEL = T.let(T.unsafe(nil), Array)
951
+
952
+ # Logging severity.
953
+ #
954
+ # source://logger//lib/logger/severity.rb#5
955
+ module Logger::Severity
956
+ class << self
957
+ # source://logger//lib/logger/severity.rb#29
958
+ def coerce(severity); end
959
+ end
960
+ end
961
+
962
+ # source://logger//lib/logger/severity.rb#19
963
+ Logger::Severity::LEVELS = T.let(T.unsafe(nil), Hash)