guard-srb 0.1.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 (60) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +37 -0
  3. data/.tool-versions +1 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/Gemfile +14 -0
  7. data/Gemfile.lock +125 -0
  8. data/Guardfile +16 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +92 -0
  11. data/Rakefile +18 -0
  12. data/lib/guard/srb/runner.rb +70 -0
  13. data/lib/guard/srb/templates/Guardfile +3 -0
  14. data/lib/guard/srb/version.rb +8 -0
  15. data/lib/guard/srb.rb +105 -0
  16. data/sorbet/config +5 -0
  17. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  18. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  19. data/sorbet/rbi/gems/coderay@1.1.3.rbi +3437 -0
  20. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
  21. data/sorbet/rbi/gems/ffi@1.15.5.rbi +8 -0
  22. data/sorbet/rbi/gems/formatador@1.1.0.rbi +8 -0
  23. data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +103 -0
  24. data/sorbet/rbi/gems/guard-minitest@2.4.6.rbi +299 -0
  25. data/sorbet/rbi/gems/guard@2.16.2.rbi +2286 -0
  26. data/sorbet/rbi/gems/json@2.6.3.rbi +1541 -0
  27. data/sorbet/rbi/gems/listen@3.8.0.rbi +1181 -0
  28. data/sorbet/rbi/gems/lumberjack@1.2.8.rbi +1501 -0
  29. data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
  30. data/sorbet/rbi/gems/minitest@5.18.0.rbi +2354 -0
  31. data/sorbet/rbi/gems/mocha@2.0.2.rbi +3934 -0
  32. data/sorbet/rbi/gems/nenv@0.3.0.rbi +146 -0
  33. data/sorbet/rbi/gems/netrc@0.11.0.rbi +161 -0
  34. data/sorbet/rbi/gems/notiffany@0.1.3.rbi +1078 -0
  35. data/sorbet/rbi/gems/parallel@1.23.0.rbi +273 -0
  36. data/sorbet/rbi/gems/parser@3.2.2.1.rbi +9454 -0
  37. data/sorbet/rbi/gems/pry@0.14.2.rbi +10079 -0
  38. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  39. data/sorbet/rbi/gems/rake@13.0.6.rbi +3119 -0
  40. data/sorbet/rbi/gems/rb-fsevent@0.11.2.rbi +8 -0
  41. data/sorbet/rbi/gems/rb-inotify@0.10.1.rbi +8 -0
  42. data/sorbet/rbi/gems/rbi@0.0.16.rbi +3049 -0
  43. data/sorbet/rbi/gems/regexp_parser@2.8.0.rbi +3765 -0
  44. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4717 -0
  45. data/sorbet/rbi/gems/rubocop-ast@1.28.1.rbi +6967 -0
  46. data/sorbet/rbi/gems/rubocop@1.50.2.rbi +55367 -0
  47. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  48. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  49. data/sorbet/rbi/gems/shellany@0.0.1.rbi +101 -0
  50. data/sorbet/rbi/gems/spoom@1.2.1.rbi +2536 -0
  51. data/sorbet/rbi/gems/tapioca@0.11.6.rbi +3246 -0
  52. data/sorbet/rbi/gems/thor@1.2.2.rbi +3965 -0
  53. data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +65 -0
  54. data/sorbet/rbi/gems/unparser@0.6.7.rbi +4515 -0
  55. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +426 -0
  56. data/sorbet/rbi/gems/yard@0.9.34.rbi +17907 -0
  57. data/sorbet/rbi/todo.rbi +7 -0
  58. data/sorbet/tapioca/config.yml +13 -0
  59. data/sorbet/tapioca/require.rb +14 -0
  60. metadata +155 -0
@@ -0,0 +1,1501 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `lumberjack` gem.
5
+ # Please instead update this file by running `bin/tapioca gem lumberjack`.
6
+
7
+ # frozen_string_literals: true
8
+ #
9
+ # source://lumberjack//lib/lumberjack.rb#8
10
+ module Lumberjack
11
+ class << self
12
+ # Contexts can be used to store tags that will be attached to all log entries in the block.
13
+ #
14
+ # If this method is called with a block, it will set a logging context for the scope of a block.
15
+ # If there is already a context in scope, a new one will be created that inherits
16
+ # all the tags of the parent context.
17
+ #
18
+ # Otherwise, it will return the current context. If one doesn't exist, it will return a new one
19
+ # but that context will not be in any scope.
20
+ #
21
+ # source://lumberjack//lib/lumberjack.rb#56
22
+ def context(&block); end
23
+
24
+ # Return true if inside a context block.
25
+ #
26
+ # @return [Boolean]
27
+ #
28
+ # source://lumberjack//lib/lumberjack.rb#77
29
+ def context?; end
30
+
31
+ # Return the tags from the current context or nil if there are no tags.
32
+ #
33
+ # source://lumberjack//lib/lumberjack.rb#82
34
+ def context_tags; end
35
+
36
+ # Set tags on the current context
37
+ #
38
+ # source://lumberjack//lib/lumberjack.rb#88
39
+ def tag(tags); end
40
+
41
+ # Define a unit of work within a block. Within the block supplied to this
42
+ # method, calling +unit_of_work_id+ will return the same value that can
43
+ # This can then be used for tying together log entries.
44
+ #
45
+ # You can specify the id for the unit of work if desired. If you don't supply
46
+ # it, a 12 digit hexidecimal number will be automatically generated for you.
47
+ #
48
+ # For the common use case of treating a single web request as a unit of work, see the
49
+ # Lumberjack::Rack::UnitOfWork class.
50
+ #
51
+ # source://lumberjack//lib/lumberjack.rb#35
52
+ def unit_of_work(id = T.unsafe(nil)); end
53
+
54
+ # Get the UniqueIdentifier for the current unit of work.
55
+ #
56
+ # source://lumberjack//lib/lumberjack.rb#44
57
+ def unit_of_work_id; end
58
+
59
+ # Set the context to use within a block.
60
+ #
61
+ # source://lumberjack//lib/lumberjack.rb#66
62
+ def use_context(context, &block); end
63
+ end
64
+ end
65
+
66
+ # A context is used to store tags that are then added to all log entries within a block.
67
+ #
68
+ # source://lumberjack//lib/lumberjack/context.rb#5
69
+ class Lumberjack::Context
70
+ # @return [Context] a new instance of Context
71
+ #
72
+ # source://lumberjack//lib/lumberjack/context.rb#8
73
+ def initialize(parent_context = T.unsafe(nil)); end
74
+
75
+ # Get a context tag.
76
+ #
77
+ # source://lumberjack//lib/lumberjack/context.rb#21
78
+ def [](key); end
79
+
80
+ # Set a context tag.
81
+ #
82
+ # source://lumberjack//lib/lumberjack/context.rb#26
83
+ def []=(key, value); end
84
+
85
+ # Clear all the context data.
86
+ #
87
+ # source://lumberjack//lib/lumberjack/context.rb#31
88
+ def reset; end
89
+
90
+ # Set tags on the context.
91
+ #
92
+ # source://lumberjack//lib/lumberjack/context.rb#14
93
+ def tag(tags); end
94
+
95
+ # Returns the value of attribute tags.
96
+ #
97
+ # source://lumberjack//lib/lumberjack/context.rb#6
98
+ def tags; end
99
+ end
100
+
101
+ # This is an abstract class for logging devices. Subclasses must implement the +write+ method and
102
+ # may implement the +close+ and +flush+ methods if applicable.
103
+ #
104
+ # source://lumberjack//lib/lumberjack/device.rb#6
105
+ class Lumberjack::Device
106
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#110
107
+ def cleanup_files!; end
108
+
109
+ # Subclasses may implement this method to close the device.
110
+ #
111
+ # source://lumberjack//lib/lumberjack/device.rb#21
112
+ def close; end
113
+
114
+ # Subclasses may implement this method to get the format for log timestamps.
115
+ #
116
+ # source://lumberjack//lib/lumberjack/device.rb#35
117
+ def datetime_format; end
118
+
119
+ # Subclasses may implement this method to set a format for log timestamps.
120
+ #
121
+ # source://lumberjack//lib/lumberjack/device.rb#39
122
+ def datetime_format=(format); end
123
+
124
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#121
125
+ def do_once(file); end
126
+
127
+ # Subclasses may implement this method to flush any buffers used by the device.
128
+ #
129
+ # source://lumberjack//lib/lumberjack/device.rb#31
130
+ def flush; end
131
+
132
+ # Subclasses may implement this method to reopen the device.
133
+ #
134
+ # source://lumberjack//lib/lumberjack/device.rb#26
135
+ def reopen(logdev = T.unsafe(nil)); end
136
+
137
+ # Subclasses must implement this method to write a LogEntry.
138
+ #
139
+ # @raise [NotImplementedError]
140
+ #
141
+ # source://lumberjack//lib/lumberjack/device.rb#16
142
+ def write(entry); end
143
+ end
144
+
145
+ # This log device will append entries to a file and roll the file periodically by date. Files
146
+ # are rolled at midnight and can be rolled daily, weekly, or monthly. Archive file names will
147
+ # have the date appended to them in the format ".YYYY-MM-DD" for daily, ".week-of-YYYY-MM-DD" for weekly
148
+ # and ".YYYY-MM" for monthly. It is not guaranteed that log messages will break exactly on the
149
+ # roll period as buffered entries will always be written to the same file.
150
+ #
151
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#15
152
+ class Lumberjack::Device::DateRollingLogFile < ::Lumberjack::Device::RollingLogFile
153
+ # Create a new logging device to the specified file. The period to roll the file is specified
154
+ # with the :roll option which may contain a value of :daily, :weekly,
155
+ # or :monthly.
156
+ #
157
+ # @return [DateRollingLogFile] a new instance of DateRollingLogFile
158
+ #
159
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#16
160
+ def initialize(path, options = T.unsafe(nil)); end
161
+
162
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#28
163
+ def archive_file_suffix; end
164
+
165
+ # @return [Boolean]
166
+ #
167
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#39
168
+ def roll_file?; end
169
+
170
+ protected
171
+
172
+ # source://lumberjack//lib/lumberjack/device/date_rolling_log_file.rb#60
173
+ def after_roll; end
174
+ end
175
+
176
+ # This is a logging device that appends log entries to a file.
177
+ #
178
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#8
179
+ class Lumberjack::Device::LogFile < ::Lumberjack::Device::Writer
180
+ # Create a logger to the file at +path+. Options are passed through to the Writer constructor.
181
+ #
182
+ # @return [LogFile] a new instance of LogFile
183
+ #
184
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#15
185
+ def initialize(path, options = T.unsafe(nil)); end
186
+
187
+ # The absolute path of the file being logged to.
188
+ #
189
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#12
190
+ def path; end
191
+
192
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#21
193
+ def reopen(logdev = T.unsafe(nil)); end
194
+
195
+ private
196
+
197
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#28
198
+ def file_stream; end
199
+ end
200
+
201
+ # source://lumberjack//lib/lumberjack/device/log_file.rb#9
202
+ Lumberjack::Device::LogFile::EXTERNAL_ENCODING = T.let(T.unsafe(nil), String)
203
+
204
+ # This is a logging device that forward log entries to multiple other devices.
205
+ #
206
+ # source://lumberjack//lib/lumberjack/device/multi.rb#6
207
+ class Lumberjack::Device::Multi < ::Lumberjack::Device
208
+ # @return [Multi] a new instance of Multi
209
+ #
210
+ # source://lumberjack//lib/lumberjack/device/multi.rb#7
211
+ def initialize(*devices); end
212
+
213
+ # source://lumberjack//lib/lumberjack/device/multi.rb#23
214
+ def close; end
215
+
216
+ # source://lumberjack//lib/lumberjack/device/multi.rb#35
217
+ def datetime_format; end
218
+
219
+ # source://lumberjack//lib/lumberjack/device/multi.rb#39
220
+ def datetime_format=(format); end
221
+
222
+ # source://lumberjack//lib/lumberjack/device/multi.rb#17
223
+ def flush; end
224
+
225
+ # source://lumberjack//lib/lumberjack/device/multi.rb#29
226
+ def reopen(logdev = T.unsafe(nil)); end
227
+
228
+ # source://lumberjack//lib/lumberjack/device/multi.rb#11
229
+ def write(entry); end
230
+ end
231
+
232
+ # This is a logging device that produces no output. It can be useful in
233
+ # testing environments when log file output is not useful.
234
+ #
235
+ # source://lumberjack//lib/lumberjack/device/null.rb#7
236
+ class Lumberjack::Device::Null < ::Lumberjack::Device
237
+ # @return [Null] a new instance of Null
238
+ #
239
+ # source://lumberjack//lib/lumberjack/device/null.rb#8
240
+ def initialize(*args); end
241
+
242
+ # source://lumberjack//lib/lumberjack/device/null.rb#11
243
+ def write(entry); end
244
+ end
245
+
246
+ # This is an abstract class for a device that appends entries to a file and periodically archives
247
+ # the existing file and starts a one. Subclasses must implement the roll_file? and archive_file_suffix
248
+ # methods.
249
+ #
250
+ # The :keep option can be used to specify a maximum number of rolled log files to keep.
251
+ # Older files will be deleted based on the time they were created. The default is to keep all files.
252
+ #
253
+ # The :min_roll_check option can be used to specify the number of seconds between checking
254
+ # the file to determine if it needs to be rolled. The default is to check at most once per second.
255
+ #
256
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#14
257
+ class Lumberjack::Device::RollingLogFile < ::Lumberjack::Device::LogFile
258
+ # @return [RollingLogFile] a new instance of RollingLogFile
259
+ #
260
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#18
261
+ def initialize(path, options = T.unsafe(nil)); end
262
+
263
+ # Returns a suffix that will be appended to the file name when it is archived.. The suffix should
264
+ # change after it is time to roll the file. The log file will be renamed when it is rolled.
265
+ #
266
+ # @raise [NotImplementedError]
267
+ #
268
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#34
269
+ def archive_file_suffix; end
270
+
271
+ # Returns the value of attribute keep.
272
+ #
273
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#16
274
+ def keep; end
275
+
276
+ # Sets the attribute keep
277
+ #
278
+ # @param value the value to set the attribute keep to.
279
+ #
280
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#16
281
+ def keep=(_arg0); end
282
+
283
+ # Returns the value of attribute path.
284
+ #
285
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#15
286
+ def path; end
287
+
288
+ # Roll the log file by renaming it to the archive file name and then re-opening a stream to the log
289
+ # file path. Rolling a file is safe in multi-threaded or multi-process environments.
290
+ #
291
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#45
292
+ def roll_file!; end
293
+
294
+ # Return +true+ if the file should be rolled.
295
+ #
296
+ # @raise [NotImplementedError]
297
+ # @return [Boolean]
298
+ #
299
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#39
300
+ def roll_file?; end
301
+
302
+ protected
303
+
304
+ # This method will be called after a file has been rolled. Subclasses can
305
+ # implement code to reset the state of the device. This method is thread safe.
306
+ #
307
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#73
308
+ def after_roll; end
309
+
310
+ # Handle rolling the file before flushing.
311
+ #
312
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#77
313
+ def before_flush; end
314
+
315
+ private
316
+
317
+ # source://lumberjack//lib/lumberjack/device/rolling_log_file.rb#96
318
+ def reopen_file; end
319
+ end
320
+
321
+ # This is a log device that appends entries to a file and rolls the file when it reaches a specified
322
+ # size threshold. When a file is rolled, it will have an number extension appended to the file name.
323
+ # For example, if the log file is named production.log, the first time it is rolled it will be renamed
324
+ # production.log.1, then production.log.2, etc.
325
+ #
326
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#9
327
+ class Lumberjack::Device::SizeRollingLogFile < ::Lumberjack::Device::RollingLogFile
328
+ # Create an new log device to the specified file. The maximum size of the log file is specified with
329
+ # the :max_size option. The unit can also be specified: "32K", "100M", "2G" are all valid.
330
+ #
331
+ # @return [SizeRollingLogFile] a new instance of SizeRollingLogFile
332
+ #
333
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#14
334
+ def initialize(path, options = T.unsafe(nil)); end
335
+
336
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#38
337
+ def archive_file_suffix; end
338
+
339
+ # Returns the value of attribute max_size.
340
+ #
341
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#10
342
+ def max_size; end
343
+
344
+ # @return [Boolean]
345
+ #
346
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#42
347
+ def roll_file?; end
348
+
349
+ protected
350
+
351
+ # Calculate the next archive file name extension.
352
+ #
353
+ # source://lumberjack//lib/lumberjack/device/size_rolling_log_file.rb#51
354
+ def next_archive_number; end
355
+ end
356
+
357
+ # This logging device writes log entries as strings to an IO stream. By default, messages will be buffered
358
+ # and written to the stream in a batch when the buffer is full or when +flush+ is called.
359
+ #
360
+ # Subclasses can implement a +before_flush+ method if they have logic to execute before flushing the log.
361
+ # If it is implemented, it will be called before every flush inside a mutex lock.
362
+ #
363
+ # source://lumberjack//lib/lumberjack/device/writer.rb#10
364
+ class Lumberjack::Device::Writer < ::Lumberjack::Device
365
+ # Create a new device to write log entries to a stream. Entries are converted to strings
366
+ # using a Template. The template can be specified using the :template option. This can
367
+ # either be a Proc or a string that will compile into a Template object.
368
+ #
369
+ # If the template is a Proc, it should accept an LogEntry as its only argument and output a string.
370
+ #
371
+ # If the template is a template string, it will be used to create a Template. The
372
+ # :additional_lines and :time_format options will be passed through to the
373
+ # Template constuctor.
374
+ #
375
+ # The default template is "[:time :severity :progname(:pid) #:unit_of_work_id] :message"
376
+ # with additional lines formatted as "\n [#:unit_of_work_id] :message". The unit of
377
+ # work id will only appear if it is present.
378
+ #
379
+ # The size of the internal buffer in bytes can be set by providing :buffer_size (defaults to 32K).
380
+ #
381
+ # @return [Writer] a new instance of Writer
382
+ #
383
+ # source://lumberjack//lib/lumberjack/device/writer.rb#63
384
+ def initialize(stream, options = T.unsafe(nil)); end
385
+
386
+ # The size of the internal buffer. Defaults to 32K.
387
+ #
388
+ # source://lumberjack//lib/lumberjack/device/writer.rb#15
389
+ def buffer_size; end
390
+
391
+ # Set the buffer size in bytes. The device will only be physically written to when the buffer size
392
+ # is exceeded.
393
+ #
394
+ # source://lumberjack//lib/lumberjack/device/writer.rb#80
395
+ def buffer_size=(value); end
396
+
397
+ # Close the underlying stream.
398
+ #
399
+ # source://lumberjack//lib/lumberjack/device/writer.rb#108
400
+ def close; end
401
+
402
+ # source://lumberjack//lib/lumberjack/device/writer.rb#123
403
+ def datetime_format; end
404
+
405
+ # source://lumberjack//lib/lumberjack/device/writer.rb#127
406
+ def datetime_format=(format); end
407
+
408
+ # Flush the underlying stream.
409
+ #
410
+ # source://lumberjack//lib/lumberjack/device/writer.rb#114
411
+ def flush; end
412
+
413
+ # Write an entry to the stream. The entry will be converted into a string using the defined template.
414
+ #
415
+ # source://lumberjack//lib/lumberjack/device/writer.rb#86
416
+ def write(entry); end
417
+
418
+ protected
419
+
420
+ # Get the underlying stream.
421
+ #
422
+ # source://lumberjack//lib/lumberjack/device/writer.rb#139
423
+ def stream; end
424
+
425
+ # Set the underlying stream.
426
+ #
427
+ # source://lumberjack//lib/lumberjack/device/writer.rb#136
428
+ def stream=(_arg0); end
429
+
430
+ private
431
+
432
+ # source://lumberjack//lib/lumberjack/device/writer.rb#143
433
+ def write_to_stream(lines); end
434
+ end
435
+
436
+ # Internal buffer to batch writes to the stream.
437
+ #
438
+ # source://lumberjack//lib/lumberjack/device/writer.rb#18
439
+ class Lumberjack::Device::Writer::Buffer
440
+ # @return [Buffer] a new instance of Buffer
441
+ #
442
+ # source://lumberjack//lib/lumberjack/device/writer.rb#21
443
+ def initialize; end
444
+
445
+ # source://lumberjack//lib/lumberjack/device/writer.rb#26
446
+ def <<(string); end
447
+
448
+ # source://lumberjack//lib/lumberjack/device/writer.rb#42
449
+ def clear; end
450
+
451
+ # @return [Boolean]
452
+ #
453
+ # source://lumberjack//lib/lumberjack/device/writer.rb#31
454
+ def empty?; end
455
+
456
+ # source://lumberjack//lib/lumberjack/device/writer.rb#35
457
+ def pop!; end
458
+
459
+ # source://lumberjack//lib/lumberjack/device/writer.rb#19
460
+ def size; end
461
+ end
462
+
463
+ # source://lumberjack//lib/lumberjack/device/writer.rb#12
464
+ Lumberjack::Device::Writer::DEFAULT_ADDITIONAL_LINES_TEMPLATE = T.let(T.unsafe(nil), String)
465
+
466
+ # source://lumberjack//lib/lumberjack/device/writer.rb#11
467
+ Lumberjack::Device::Writer::DEFAULT_FIRST_LINE_TEMPLATE = T.let(T.unsafe(nil), String)
468
+
469
+ # This class controls the conversion of log entry messages into a loggable format. This allows you
470
+ # to log any object you want and have the logging system deal with converting it into a string.
471
+ #
472
+ # Formats are added to a Formatter by associating them with a class using the +add+ method. Formats
473
+ # are any object that responds to the +call+ method.
474
+ #
475
+ # By default, all object will be converted to strings using their inspect method except for Strings
476
+ # and Exceptions. Strings are not converted and Exceptions are converted using the ExceptionFormatter.
477
+ #
478
+ # Enumerable objects (including Hash and Array) will call the formatter recursively for each element.
479
+ #
480
+ # source://lumberjack//lib/lumberjack/formatter.rb#14
481
+ class Lumberjack::Formatter
482
+ # @return [Formatter] a new instance of Formatter
483
+ #
484
+ # source://lumberjack//lib/lumberjack/formatter.rb#34
485
+ def initialize; end
486
+
487
+ # Add a formatter for a class. The formatter can be specified as either an object
488
+ # that responds to the +call+ method or as a symbol representing one of the predefined
489
+ # formatters, or as a block to the method call.
490
+ #
491
+ # The predefined formatters are: :inspect, :string, :exception, and :pretty_print.
492
+ #
493
+ # You can add multiple classes at once by passing an array of classes.
494
+ #
495
+ # You can also pass class names as strings instead of the classes themselves. This can
496
+ # help avoid loading dependency issues. This applies only to classes; modules cannot be
497
+ # passed in as strings.
498
+ #
499
+ # === Examples
500
+ #
501
+ # # Use a predefined formatter
502
+ # formatter.add(MyClass, :pretty_print)
503
+ #
504
+ # # Pass in a formatter object
505
+ # formatter.add(MyClass, Lumberjack::Formatter::PrettyPrintFormatter.new)
506
+ #
507
+ # # Use a block
508
+ # formatter.add(MyClass){|obj| obj.humanize}
509
+ #
510
+ # # Add statements can be chained together
511
+ # formatter.add(MyClass, :pretty_print).add(YourClass){|obj| obj.humanize}
512
+ #
513
+ # source://lumberjack//lib/lumberjack/formatter.rb#69
514
+ def add(klass, formatter = T.unsafe(nil), &block); end
515
+
516
+ # Compatibility with the Logger::Formatter signature. This method will just convert the message
517
+ # object to a string and ignores the other parameters.
518
+ #
519
+ # source://lumberjack//lib/lumberjack/formatter.rb#129
520
+ def call(severity, timestamp, progname, msg); end
521
+
522
+ # Remove all formatters including the default formatter. Can be chained to add method calls.
523
+ #
524
+ # source://lumberjack//lib/lumberjack/formatter.rb#111
525
+ def clear; end
526
+
527
+ # Format a message object as a string.
528
+ #
529
+ # source://lumberjack//lib/lumberjack/formatter.rb#118
530
+ def format(message); end
531
+
532
+ # Remove the formatter associated with a class. Remove statements can be chained together.
533
+ #
534
+ # You can remove multiple classes at once by passing an array of classes.
535
+ #
536
+ # You can also pass class names as strings instead of the classes themselves. This can
537
+ # help avoid loading dependency issues. This applies only to classes; modules cannot be
538
+ # passed in as strings.
539
+ #
540
+ # source://lumberjack//lib/lumberjack/formatter.rb#98
541
+ def remove(klass); end
542
+
543
+ private
544
+
545
+ # Find the formatter for a class by looking it up using the class hierarchy.
546
+ #
547
+ # source://lumberjack//lib/lumberjack/formatter.rb#136
548
+ def formatter_for(klass); end
549
+
550
+ class << self
551
+ # Returns a new empty formatter with no mapping. For historical reasons, a formatter
552
+ # is initialized with mappings to help output objects as strings. This will return one
553
+ # without the default mappings.
554
+ #
555
+ # source://lumberjack//lib/lumberjack/formatter.rb#29
556
+ def empty; end
557
+ end
558
+ end
559
+
560
+ # Format a Date, Time, or DateTime object. If you don't specify a format in the constructor,
561
+ # it will use the ISO-8601 format.
562
+ #
563
+ # source://lumberjack//lib/lumberjack/formatter/date_time_formatter.rb#7
564
+ class Lumberjack::Formatter::DateTimeFormatter
565
+ # @return [DateTimeFormatter] a new instance of DateTimeFormatter
566
+ #
567
+ # source://lumberjack//lib/lumberjack/formatter/date_time_formatter.rb#10
568
+ def initialize(format = T.unsafe(nil)); end
569
+
570
+ # source://lumberjack//lib/lumberjack/formatter/date_time_formatter.rb#14
571
+ def call(obj); end
572
+
573
+ # Returns the value of attribute format.
574
+ #
575
+ # source://lumberjack//lib/lumberjack/formatter/date_time_formatter.rb#8
576
+ def format; end
577
+ end
578
+
579
+ # Format an exception including the backtrace. You can specify an object that
580
+ # responds to `call` as a backtrace cleaner. The exception backtrace will be
581
+ # passed to this object and the returned array is what will be logged. You can
582
+ # use this to clean out superfluous lines.
583
+ #
584
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#9
585
+ class Lumberjack::Formatter::ExceptionFormatter
586
+ # @return [ExceptionFormatter] a new instance of ExceptionFormatter
587
+ #
588
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#12
589
+ def initialize(backtrace_cleaner = T.unsafe(nil)); end
590
+
591
+ # Returns the value of attribute backtrace_cleaner.
592
+ #
593
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#10
594
+ def backtrace_cleaner; end
595
+
596
+ # Sets the attribute backtrace_cleaner
597
+ #
598
+ # @param value the value to set the attribute backtrace_cleaner to.
599
+ #
600
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#10
601
+ def backtrace_cleaner=(_arg0); end
602
+
603
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#16
604
+ def call(exception); end
605
+
606
+ private
607
+
608
+ # source://lumberjack//lib/lumberjack/formatter/exception_formatter.rb#28
609
+ def clean_backtrace(trace); end
610
+ end
611
+
612
+ # Format an object that has an id as a hash with keys for class and id. This formatter is useful
613
+ # as a default formatter for objects pulled from a data store. By default it will use :id as the
614
+ # id attribute.
615
+ #
616
+ # source://lumberjack//lib/lumberjack/formatter/id_formatter.rb#8
617
+ class Lumberjack::Formatter::IdFormatter
618
+ # @return [IdFormatter] a new instance of IdFormatter
619
+ #
620
+ # source://lumberjack//lib/lumberjack/formatter/id_formatter.rb#9
621
+ def initialize(id_attribute = T.unsafe(nil)); end
622
+
623
+ # source://lumberjack//lib/lumberjack/formatter/id_formatter.rb#13
624
+ def call(obj); end
625
+ end
626
+
627
+ # Format an object by calling +inspect+ on it.
628
+ #
629
+ # source://lumberjack//lib/lumberjack/formatter/inspect_formatter.rb#6
630
+ class Lumberjack::Formatter::InspectFormatter
631
+ # source://lumberjack//lib/lumberjack/formatter/inspect_formatter.rb#7
632
+ def call(obj); end
633
+ end
634
+
635
+ # No-op formatter that just returns the object itself.
636
+ #
637
+ # source://lumberjack//lib/lumberjack/formatter/object_formatter.rb#6
638
+ class Lumberjack::Formatter::ObjectFormatter
639
+ # source://lumberjack//lib/lumberjack/formatter/object_formatter.rb#7
640
+ def call(obj); end
641
+ end
642
+
643
+ # Format an object with it's pretty print method.
644
+ #
645
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#9
646
+ class Lumberjack::Formatter::PrettyPrintFormatter
647
+ # Create a new formatter. The maximum width of the message can be specified with the width
648
+ # parameter (defaults to 79 characters).
649
+ #
650
+ # @return [PrettyPrintFormatter] a new instance of PrettyPrintFormatter
651
+ #
652
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#14
653
+ def initialize(width = T.unsafe(nil)); end
654
+
655
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#18
656
+ def call(obj); end
657
+
658
+ # Returns the value of attribute width.
659
+ #
660
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#10
661
+ def width; end
662
+
663
+ # Sets the attribute width
664
+ #
665
+ # @param value the value to set the attribute width to.
666
+ #
667
+ # source://lumberjack//lib/lumberjack/formatter/pretty_print_formatter.rb#10
668
+ def width=(_arg0); end
669
+ end
670
+
671
+ # Format an object by calling `to_s` on it.
672
+ #
673
+ # source://lumberjack//lib/lumberjack/formatter/string_formatter.rb#6
674
+ class Lumberjack::Formatter::StringFormatter
675
+ # source://lumberjack//lib/lumberjack/formatter/string_formatter.rb#7
676
+ def call(obj); end
677
+ end
678
+
679
+ # Format an object by calling `to_s` on it and stripping leading and trailing whitespace.
680
+ #
681
+ # source://lumberjack//lib/lumberjack/formatter/strip_formatter.rb#6
682
+ class Lumberjack::Formatter::StripFormatter
683
+ # source://lumberjack//lib/lumberjack/formatter/strip_formatter.rb#7
684
+ def call(obj); end
685
+ end
686
+
687
+ # Dereference arrays and hashes and recursively call formatters on each element.
688
+ #
689
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#8
690
+ class Lumberjack::Formatter::StructuredFormatter
691
+ # @return [StructuredFormatter] a new instance of StructuredFormatter
692
+ #
693
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#12
694
+ def initialize(formatter = T.unsafe(nil)); end
695
+
696
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#16
697
+ def call(obj); end
698
+
699
+ private
700
+
701
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#22
702
+ def call_with_references(obj, references); end
703
+
704
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#48
705
+ def with_object_reference(obj, references); end
706
+ end
707
+
708
+ # source://lumberjack//lib/lumberjack/formatter/structured_formatter.rb#9
709
+ class Lumberjack::Formatter::StructuredFormatter::RecusiveReferenceError < ::StandardError; end
710
+
711
+ # source://lumberjack//lib/lumberjack.rb#9
712
+ Lumberjack::LINE_SEPARATOR = T.let(T.unsafe(nil), String)
713
+
714
+ # An entry in a log is a data structure that captures the log message as well as
715
+ # information about the system that logged the message.
716
+ #
717
+ # source://lumberjack//lib/lumberjack/log_entry.rb#6
718
+ class Lumberjack::LogEntry
719
+ # @return [LogEntry] a new instance of LogEntry
720
+ #
721
+ # source://lumberjack//lib/lumberjack/log_entry.rb#13
722
+ def initialize(time, severity, message, progname, pid, tags); end
723
+
724
+ # source://lumberjack//lib/lumberjack/log_entry.rb#35
725
+ def inspect; end
726
+
727
+ # Returns the value of attribute message.
728
+ #
729
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
730
+ def message; end
731
+
732
+ # Sets the attribute message
733
+ #
734
+ # @param value the value to set the attribute message to.
735
+ #
736
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
737
+ def message=(_arg0); end
738
+
739
+ # Returns the value of attribute pid.
740
+ #
741
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
742
+ def pid; end
743
+
744
+ # Sets the attribute pid
745
+ #
746
+ # @param value the value to set the attribute pid to.
747
+ #
748
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
749
+ def pid=(_arg0); end
750
+
751
+ # Returns the value of attribute progname.
752
+ #
753
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
754
+ def progname; end
755
+
756
+ # Sets the attribute progname
757
+ #
758
+ # @param value the value to set the attribute progname to.
759
+ #
760
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
761
+ def progname=(_arg0); end
762
+
763
+ # Returns the value of attribute severity.
764
+ #
765
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
766
+ def severity; end
767
+
768
+ # Sets the attribute severity
769
+ #
770
+ # @param value the value to set the attribute severity to.
771
+ #
772
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
773
+ def severity=(_arg0); end
774
+
775
+ # source://lumberjack//lib/lumberjack/log_entry.rb#27
776
+ def severity_label; end
777
+
778
+ # Return the tag with the specified name.
779
+ #
780
+ # source://lumberjack//lib/lumberjack/log_entry.rb#54
781
+ def tag(name); end
782
+
783
+ # Returns the value of attribute tags.
784
+ #
785
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
786
+ def tags; end
787
+
788
+ # Sets the attribute tags
789
+ #
790
+ # @param value the value to set the attribute tags to.
791
+ #
792
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
793
+ def tags=(_arg0); end
794
+
795
+ # Returns the value of attribute time.
796
+ #
797
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
798
+ def time; end
799
+
800
+ # Sets the attribute time
801
+ #
802
+ # @param value the value to set the attribute time to.
803
+ #
804
+ # source://lumberjack//lib/lumberjack/log_entry.rb#7
805
+ def time=(_arg0); end
806
+
807
+ # source://lumberjack//lib/lumberjack/log_entry.rb#31
808
+ def to_s; end
809
+
810
+ # Deprecated - backward compatibility with 1.0 API
811
+ #
812
+ # source://lumberjack//lib/lumberjack/log_entry.rb#40
813
+ def unit_of_work_id; end
814
+
815
+ # Deprecated - backward compatibility with 1.0 API
816
+ #
817
+ # source://lumberjack//lib/lumberjack/log_entry.rb#45
818
+ def unit_of_work_id=(value); end
819
+
820
+ private
821
+
822
+ # source://lumberjack//lib/lumberjack/log_entry.rb#60
823
+ def tags_to_s; end
824
+ end
825
+
826
+ # source://lumberjack//lib/lumberjack/log_entry.rb#9
827
+ Lumberjack::LogEntry::TIME_FORMAT = T.let(T.unsafe(nil), String)
828
+
829
+ # source://lumberjack//lib/lumberjack/log_entry.rb#11
830
+ Lumberjack::LogEntry::UNIT_OF_WORK_ID = T.let(T.unsafe(nil), String)
831
+
832
+ # Logger is a thread safe logging object. It has a compatible API with the Ruby
833
+ # standard library Logger class, the Log4r gem, and ActiveSupport::BufferedLogger.
834
+ #
835
+ # === Example
836
+ #
837
+ # logger = Lumberjack::Logger.new
838
+ # logger.info("Starting processing")
839
+ # logger.debug("Processing options #{options.inspect}")
840
+ # logger.fatal("OMG the application is on fire!")
841
+ #
842
+ # Log entries are written to a logging Device if their severity meets or exceeds the log level.
843
+ #
844
+ # Devices may use buffers internally and the log entries are not guaranteed to be written until you call
845
+ # the +flush+ method. Sometimes this can result in problems when trying to track down extraordinarily
846
+ # long running sections of code since it is likely that none of the messages logged before the long
847
+ # running code will appear in the log until the entire process finishes. You can set the +:flush_seconds+
848
+ # option on the constructor to force the device to be flushed periodically. This will create a new
849
+ # monitoring thread, but its use is highly recommended.
850
+ #
851
+ # Each log entry records the log message and severity along with the time it was logged, the
852
+ # program name, process id, and unit of work id. The message will be converted to a string, but
853
+ # otherwise, it is up to the device how these values are recorded. Messages are converted to strings
854
+ # using a Formatter associated with the logger.
855
+ #
856
+ # source://lumberjack//lib/lumberjack/logger.rb#27
857
+ class Lumberjack::Logger
858
+ include ::Lumberjack::Severity
859
+
860
+ # Create a new logger to log to a Device.
861
+ #
862
+ # The +device+ argument can be in any one of several formats.
863
+ #
864
+ # If it is a Device object, that object will be used.
865
+ # If it has a +write+ method, it will be wrapped in a Device::Writer class.
866
+ # If it is :null, it will be a Null device that won't record any output.
867
+ # Otherwise, it will be assumed to be file path and wrapped in a Device::LogFile class.
868
+ #
869
+ # This method can take the following options:
870
+ #
871
+ # * :level - The logging level below which messages will be ignored.
872
+ # * :formatter - The formatter to use for outputting messages to the log.
873
+ # * :datetime_format - The format to use for log timestamps.
874
+ # * :tag_formatter - The TagFormatter to use for formatting tags.
875
+ # * :progname - The name of the program that will be recorded with each log entry.
876
+ # * :flush_seconds - The maximum number of seconds between flush calls.
877
+ # * :roll - If the log device is a file path, it will be a Device::DateRollingLogFile if this is set.
878
+ # * :max_size - If the log device is a file path, it will be a Device::SizeRollingLogFile if this is set.
879
+ #
880
+ # All other options are passed to the device constuctor.
881
+ #
882
+ # @return [Logger] a new instance of Logger
883
+ #
884
+ # source://lumberjack//lib/lumberjack/logger.rb#66
885
+ def initialize(device = T.unsafe(nil), options = T.unsafe(nil)); end
886
+
887
+ # source://lumberjack//lib/lumberjack/logger.rb#312
888
+ def <<(msg); end
889
+
890
+ # ::Logger compatible method to add a log entry.
891
+ #
892
+ # source://lumberjack//lib/lumberjack/logger.rb#194
893
+ def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end
894
+
895
+ # Add a message to the log with a given severity. The message can be either
896
+ # passed in the +message+ argument or supplied with a block. This method
897
+ # is not normally called. Instead call one of the helper functions
898
+ # +fatal+, +error+, +warn+, +info+, or +debug+.
899
+ #
900
+ # The severity can be passed in either as one of the Severity constants,
901
+ # or as a Severity label.
902
+ #
903
+ # === Example
904
+ #
905
+ # logger.add_entry(Logger::ERROR, exception)
906
+ # logger.add_entry(Logger::INFO, "Request completed")
907
+ # logger.add_entry(:warn, "Request took a long time")
908
+ # logger.add_entry(Logger::DEBUG){"Start processing with options #{options.inspect}"}
909
+ #
910
+ # source://lumberjack//lib/lumberjack/logger.rb#158
911
+ def add_entry(severity, message, progname = T.unsafe(nil), tags = T.unsafe(nil)); end
912
+
913
+ # Close the logging device.
914
+ #
915
+ # source://lumberjack//lib/lumberjack/logger.rb#216
916
+ def close; end
917
+
918
+ # @return [Boolean]
919
+ #
920
+ # source://lumberjack//lib/lumberjack/logger.rb#222
921
+ def closed?; end
922
+
923
+ # Get the timestamp format on the device if it has one.
924
+ #
925
+ # source://lumberjack//lib/lumberjack/logger.rb#86
926
+ def datetime_format; end
927
+
928
+ # Set the timestamp format on the device if it is supported.
929
+ #
930
+ # source://lumberjack//lib/lumberjack/logger.rb#91
931
+ def datetime_format=(format); end
932
+
933
+ # Log a +DEBUG+ message. The message can be passed in either the +message+ argument or in a block.
934
+ #
935
+ # source://lumberjack//lib/lumberjack/logger.rb#292
936
+ def debug(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
937
+
938
+ # Set the log level to debug.
939
+ #
940
+ # source://lumberjack//lib/lumberjack/logger.rb#302
941
+ def debug!; end
942
+
943
+ # Return +true+ if +DEBUG+ messages are being logged.
944
+ #
945
+ # @return [Boolean]
946
+ #
947
+ # source://lumberjack//lib/lumberjack/logger.rb#297
948
+ def debug?; end
949
+
950
+ # The device being written to
951
+ #
952
+ # source://lumberjack//lib/lumberjack/logger.rb#40
953
+ def device; end
954
+
955
+ # The device being written to
956
+ #
957
+ # source://lumberjack//lib/lumberjack/logger.rb#40
958
+ def device=(_arg0); end
959
+
960
+ # Log an +ERROR+ message. The message can be passed in either the +message+ argument or in a block.
961
+ #
962
+ # source://lumberjack//lib/lumberjack/logger.rb#247
963
+ def error(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
964
+
965
+ # Set the log level to error.
966
+ #
967
+ # source://lumberjack//lib/lumberjack/logger.rb#257
968
+ def error!; end
969
+
970
+ # Return +true+ if +ERROR+ messages are being logged.
971
+ #
972
+ # @return [Boolean]
973
+ #
974
+ # source://lumberjack//lib/lumberjack/logger.rb#252
975
+ def error?; end
976
+
977
+ # Log a +FATAL+ message. The message can be passed in either the +message+ argument or in a block.
978
+ #
979
+ # source://lumberjack//lib/lumberjack/logger.rb#232
980
+ def fatal(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
981
+
982
+ # Set the log level to fatal.
983
+ #
984
+ # source://lumberjack//lib/lumberjack/logger.rb#242
985
+ def fatal!; end
986
+
987
+ # Return +true+ if +FATAL+ messages are being logged.
988
+ #
989
+ # @return [Boolean]
990
+ #
991
+ # source://lumberjack//lib/lumberjack/logger.rb#237
992
+ def fatal?; end
993
+
994
+ # Flush the logging device. Messages are not guaranteed to be written until this method is called.
995
+ #
996
+ # source://lumberjack//lib/lumberjack/logger.rb#209
997
+ def flush; end
998
+
999
+ # Get the Lumberjack::Formatter used to format objects for logging as messages.
1000
+ #
1001
+ # source://lumberjack//lib/lumberjack/logger.rb#123
1002
+ def formatter; end
1003
+
1004
+ # Set the Lumberjack::Formatter used to format objects for logging as messages.
1005
+ #
1006
+ # source://lumberjack//lib/lumberjack/logger.rb#118
1007
+ def formatter=(value); end
1008
+
1009
+ # Log an +INFO+ message. The message can be passed in either the +message+ argument or in a block.
1010
+ #
1011
+ # source://lumberjack//lib/lumberjack/logger.rb#277
1012
+ def info(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1013
+
1014
+ # Set the log level to info.
1015
+ #
1016
+ # source://lumberjack//lib/lumberjack/logger.rb#287
1017
+ def info!; end
1018
+
1019
+ # Return +true+ if +INFO+ messages are being logged.
1020
+ #
1021
+ # @return [Boolean]
1022
+ #
1023
+ # source://lumberjack//lib/lumberjack/logger.rb#282
1024
+ def info?; end
1025
+
1026
+ # The time that the device was last flushed.
1027
+ #
1028
+ # source://lumberjack//lib/lumberjack/logger.rb#31
1029
+ def last_flushed_at; end
1030
+
1031
+ # Get the level of severity of entries that are logged. Entries with a lower
1032
+ # severity level will be ignored.
1033
+ #
1034
+ # source://lumberjack//lib/lumberjack/logger.rb#99
1035
+ def level; end
1036
+
1037
+ # Set the log level using either an integer level like Logger::INFO or a label like
1038
+ # :info or "info"
1039
+ #
1040
+ # source://lumberjack//lib/lumberjack/logger.rb#107
1041
+ def level=(value); end
1042
+
1043
+ # ::Logger compatible method to add a log entry.
1044
+ #
1045
+ # source://lumberjack//lib/lumberjack/logger.rb#194
1046
+ def log(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end
1047
+
1048
+ # Get the program name associated with log messages.
1049
+ #
1050
+ # source://lumberjack//lib/lumberjack/logger.rb#347
1051
+ def progname; end
1052
+
1053
+ # Set the name of the program to attach to log entries.
1054
+ #
1055
+ # source://lumberjack//lib/lumberjack/logger.rb#37
1056
+ def progname=(_arg0); end
1057
+
1058
+ # Remove a tag from the current tag context. If this is called inside a block to a
1059
+ # call to `tag`, the tags will only be removed for the duration of that block. Otherwise
1060
+ # they will be removed from the global tags.
1061
+ #
1062
+ # source://lumberjack//lib/lumberjack/logger.rb#374
1063
+ def remove_tag(*tag_names); end
1064
+
1065
+ # source://lumberjack//lib/lumberjack/logger.rb#226
1066
+ def reopen(logdev = T.unsafe(nil)); end
1067
+
1068
+ # Set the program name that is associated with log messages. If a block
1069
+ # is given, the program name will be valid only within the block.
1070
+ #
1071
+ # source://lumberjack//lib/lumberjack/logger.rb#338
1072
+ def set_progname(value, &block); end
1073
+
1074
+ # Get the level of severity of entries that are logged. Entries with a lower
1075
+ # severity level will be ignored.
1076
+ #
1077
+ # source://lumberjack//lib/lumberjack/logger.rb#99
1078
+ def sev_threshold; end
1079
+
1080
+ # Set the log level using either an integer level like Logger::INFO or a label like
1081
+ # :info or "info"
1082
+ #
1083
+ # source://lumberjack//lib/lumberjack/logger.rb#107
1084
+ def sev_threshold=(value); end
1085
+
1086
+ # Silence the logger by setting a new log level inside a block. By default, only +ERROR+ or +FATAL+
1087
+ # messages will be logged.
1088
+ #
1089
+ # === Example
1090
+ #
1091
+ # logger.level = Logger::INFO
1092
+ # logger.silence do
1093
+ # do_something # Log level inside the block is +ERROR+
1094
+ # end
1095
+ #
1096
+ # source://lumberjack//lib/lumberjack/logger.rb#325
1097
+ def silence(temporary_level = T.unsafe(nil), &block); end
1098
+
1099
+ # Set +silencer+ to false to disable silencing the log.
1100
+ #
1101
+ # source://lumberjack//lib/lumberjack/logger.rb#34
1102
+ def silencer; end
1103
+
1104
+ # Set +silencer+ to false to disable silencing the log.
1105
+ #
1106
+ # source://lumberjack//lib/lumberjack/logger.rb#34
1107
+ def silencer=(_arg0); end
1108
+
1109
+ # Set a hash of tags on logger. If a block is given, the tags will only be set
1110
+ # for the duration of the block. If this method is called inside such a block,
1111
+ # the tags will only be defined on the tags in that block. When the parent block
1112
+ # exits, all the tags will be reverted. If there is no block, then the tags will
1113
+ # be defined as global and apply to all log statements.
1114
+ #
1115
+ # source://lumberjack//lib/lumberjack/logger.rb#356
1116
+ def tag(tags, &block); end
1117
+
1118
+ # The TagFormatter used for formatting tags for output
1119
+ #
1120
+ # source://lumberjack//lib/lumberjack/logger.rb#43
1121
+ def tag_formatter; end
1122
+
1123
+ # The TagFormatter used for formatting tags for output
1124
+ #
1125
+ # source://lumberjack//lib/lumberjack/logger.rb#43
1126
+ def tag_formatter=(_arg0); end
1127
+
1128
+ # Enable this logger to function like an ActiveSupport::TaggedLogger. This will make the logger
1129
+ # API compatible with ActiveSupport::TaggedLogger and is provided as a means of compatibility
1130
+ # with other libraries that assume they can call the `tagged` method on a logger to add tags.
1131
+ #
1132
+ # The tags added with this method are just strings so they are stored in the logger tags
1133
+ # in an array under the "tagged" tag. So calling `logger.tagged("foo", "bar")` will result
1134
+ # in tags `{"tagged" => ["foo", "bar"]}`.
1135
+ #
1136
+ # source://lumberjack//lib/lumberjack/logger.rb#139
1137
+ def tagged_logger!; end
1138
+
1139
+ # Return all tags in scope on the logger including global tags set on the Lumberjack
1140
+ # context, tags set on the logger, and tags set on the current block for the logger.
1141
+ #
1142
+ # source://lumberjack//lib/lumberjack/logger.rb#385
1143
+ def tags; end
1144
+
1145
+ # Log a message when the severity is not known. Unknown messages will always appear in the log.
1146
+ # The message can be passed in either the +message+ argument or in a block.
1147
+ #
1148
+ # source://lumberjack//lib/lumberjack/logger.rb#308
1149
+ def unknown(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1150
+
1151
+ # Remove all tags on the current logger and logging context within a block.
1152
+ # You can still set new block scoped tags within theuntagged block and provide
1153
+ # tags on individual log methods.
1154
+ #
1155
+ # source://lumberjack//lib/lumberjack/logger.rb#398
1156
+ def untagged(&block); end
1157
+
1158
+ # Log a +WARN+ message. The message can be passed in either the +message+ argument or in a block.
1159
+ #
1160
+ # source://lumberjack//lib/lumberjack/logger.rb#262
1161
+ def warn(message_or_progname_or_tags = T.unsafe(nil), progname_or_tags = T.unsafe(nil), &block); end
1162
+
1163
+ # Set the log level to warn.
1164
+ #
1165
+ # source://lumberjack//lib/lumberjack/logger.rb#272
1166
+ def warn!; end
1167
+
1168
+ # Return +true+ if +WARN+ messages are being logged.
1169
+ #
1170
+ # @return [Boolean]
1171
+ #
1172
+ # source://lumberjack//lib/lumberjack/logger.rb#267
1173
+ def warn?; end
1174
+
1175
+ private
1176
+
1177
+ # Dereference arguments to log calls so we can have methods with compatibility with ::Logger
1178
+ #
1179
+ # source://lumberjack//lib/lumberjack/logger.rb#416
1180
+ def call_add_entry(severity, message_or_progname_or_tags, progname_or_tags, &block); end
1181
+
1182
+ # Create a thread that will periodically call flush.
1183
+ #
1184
+ # source://lumberjack//lib/lumberjack/logger.rb#504
1185
+ def create_flusher_thread(flush_seconds); end
1186
+
1187
+ # Open a logging device.
1188
+ #
1189
+ # source://lumberjack//lib/lumberjack/logger.rb#473
1190
+ def open_device(device, options); end
1191
+
1192
+ # Set a local value for a thread tied to this object within a block.
1193
+ #
1194
+ # source://lumberjack//lib/lumberjack/logger.rb#462
1195
+ def push_thread_local_value(name, value); end
1196
+
1197
+ # Set a local value for a thread tied to this object.
1198
+ #
1199
+ # source://lumberjack//lib/lumberjack/logger.rb#441
1200
+ def set_thread_local_value(name, value); end
1201
+
1202
+ # Get a local value for a thread tied to this object.
1203
+ #
1204
+ # source://lumberjack//lib/lumberjack/logger.rb#456
1205
+ def thread_local_value(name); end
1206
+
1207
+ # source://lumberjack//lib/lumberjack/logger.rb#494
1208
+ def write_to_device(entry); end
1209
+ end
1210
+
1211
+ # source://lumberjack//lib/lumberjack/rack.rb#4
1212
+ module Lumberjack::Rack; end
1213
+
1214
+ # Middleware to create a global context for Lumberjack for the scope of a rack request.
1215
+ #
1216
+ # source://lumberjack//lib/lumberjack/rack/context.rb#6
1217
+ class Lumberjack::Rack::Context
1218
+ # @return [Context] a new instance of Context
1219
+ #
1220
+ # source://lumberjack//lib/lumberjack/rack/context.rb#7
1221
+ def initialize(app); end
1222
+
1223
+ # source://lumberjack//lib/lumberjack/rack/context.rb#11
1224
+ def call(env); end
1225
+ end
1226
+
1227
+ # Support for using the Rails ActionDispatch request id in the log.
1228
+ # The format is expected to be a random UUID and only the first chunk is used for terseness
1229
+ # if the abbreviated argument is true.
1230
+ #
1231
+ # source://lumberjack//lib/lumberjack/rack/request_id.rb#8
1232
+ class Lumberjack::Rack::RequestId
1233
+ # @return [RequestId] a new instance of RequestId
1234
+ #
1235
+ # source://lumberjack//lib/lumberjack/rack/request_id.rb#11
1236
+ def initialize(app, abbreviated = T.unsafe(nil)); end
1237
+
1238
+ # source://lumberjack//lib/lumberjack/rack/request_id.rb#16
1239
+ def call(env); end
1240
+ end
1241
+
1242
+ # source://lumberjack//lib/lumberjack/rack/request_id.rb#9
1243
+ Lumberjack::Rack::RequestId::REQUEST_ID = T.let(T.unsafe(nil), String)
1244
+
1245
+ # source://lumberjack//lib/lumberjack/rack/unit_of_work.rb#5
1246
+ class Lumberjack::Rack::UnitOfWork
1247
+ # @return [UnitOfWork] a new instance of UnitOfWork
1248
+ #
1249
+ # source://lumberjack//lib/lumberjack/rack/unit_of_work.rb#6
1250
+ def initialize(app); end
1251
+
1252
+ # source://lumberjack//lib/lumberjack/rack/unit_of_work.rb#10
1253
+ def call(env); end
1254
+ end
1255
+
1256
+ # The standard severity levels for logging messages.
1257
+ #
1258
+ # source://lumberjack//lib/lumberjack/severity.rb#5
1259
+ module Lumberjack::Severity
1260
+ class << self
1261
+ # source://lumberjack//lib/lumberjack/severity.rb#21
1262
+ def label_to_level(label); end
1263
+
1264
+ # source://lumberjack//lib/lumberjack/severity.rb#17
1265
+ def level_to_label(severity); end
1266
+ end
1267
+ end
1268
+
1269
+ # Backward compatibilty with 1.0 API
1270
+ #
1271
+ # source://lumberjack//lib/lumberjack/severity.rb#7
1272
+ Lumberjack::Severity::DEBUG = T.let(T.unsafe(nil), Integer)
1273
+
1274
+ # source://lumberjack//lib/lumberjack/severity.rb#10
1275
+ Lumberjack::Severity::ERROR = T.let(T.unsafe(nil), Integer)
1276
+
1277
+ # source://lumberjack//lib/lumberjack/severity.rb#11
1278
+ Lumberjack::Severity::FATAL = T.let(T.unsafe(nil), Integer)
1279
+
1280
+ # source://lumberjack//lib/lumberjack/severity.rb#8
1281
+ Lumberjack::Severity::INFO = T.let(T.unsafe(nil), Integer)
1282
+
1283
+ # source://lumberjack//lib/lumberjack/severity.rb#14
1284
+ Lumberjack::Severity::SEVERITY_LABELS = T.let(T.unsafe(nil), Array)
1285
+
1286
+ # source://lumberjack//lib/lumberjack/severity.rb#12
1287
+ Lumberjack::Severity::UNKNOWN = T.let(T.unsafe(nil), Integer)
1288
+
1289
+ # source://lumberjack//lib/lumberjack/severity.rb#9
1290
+ Lumberjack::Severity::WARN = T.let(T.unsafe(nil), Integer)
1291
+
1292
+ # Class for formatting tags. You can register a default formatter and tag
1293
+ # name specific formatters. Formatters can be either `Lumberjack::Formatter`
1294
+ # objects or any object that responds to `call`.
1295
+ #
1296
+ # tag_formatter = Lumberjack::TagFormatter.new.default(Lumberjack::Formatter.new)
1297
+ # tag_formatter.add(["password", "email"]) { |value| "***" }
1298
+ # tag_formatter.add("finished_at", Lumberjack::Formatter::DateTimeFormatter.new("%Y-%m-%dT%H:%m:%S%z"))
1299
+ #
1300
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#11
1301
+ class Lumberjack::TagFormatter
1302
+ # @return [TagFormatter] a new instance of TagFormatter
1303
+ #
1304
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#12
1305
+ def initialize; end
1306
+
1307
+ # Add a formatter for specific tag names. This can either be a Lumberjack::Formatter
1308
+ # or an object that responds to `call` or a block. The default formatter will not be
1309
+ # applied.
1310
+ #
1311
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#35
1312
+ def add(names, formatter = T.unsafe(nil), &block); end
1313
+
1314
+ # Remove all formatters.
1315
+ #
1316
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#57
1317
+ def clear; end
1318
+
1319
+ # Add a default formatter applied to all tag values. This can either be a Lumberjack::Formatter
1320
+ # or an object that responds to `call` or a block.
1321
+ #
1322
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#19
1323
+ def default(formatter = T.unsafe(nil), &block); end
1324
+
1325
+ # Format a hash of tags using the formatters
1326
+ #
1327
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#64
1328
+ def format(tags); end
1329
+
1330
+ # Remove formatters for specific tag names. The default formatter will still be applied.
1331
+ #
1332
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#49
1333
+ def remove(names); end
1334
+
1335
+ # Remove the default formatter.
1336
+ #
1337
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#27
1338
+ def remove_default; end
1339
+
1340
+ private
1341
+
1342
+ # source://lumberjack//lib/lumberjack/tag_formatter.rb#85
1343
+ def dereference_formatter(formatter); end
1344
+ end
1345
+
1346
+ # Methods to make Lumberjack::Logger API compatible with ActiveSupport::TaggedLogger.
1347
+ #
1348
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#8
1349
+ module Lumberjack::TaggedLoggerSupport
1350
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#62
1351
+ def clear_tags!; end
1352
+
1353
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#56
1354
+ def pop_tags(size = T.unsafe(nil)); end
1355
+
1356
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#52
1357
+ def push_tags(*tags); end
1358
+
1359
+ # Compatibility with ActiveSupport::TaggedLogging which only supports adding tags as strings.
1360
+ # If a tag looks like "key:value" or "key=value", it will be added as a key value pair.
1361
+ # Otherwise it will be appended to a list named "tagged".
1362
+ #
1363
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#43
1364
+ def tagged(*tags, &block); end
1365
+ end
1366
+
1367
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#9
1368
+ class Lumberjack::TaggedLoggerSupport::Formatter
1369
+ extend ::Forwardable
1370
+
1371
+ # @return [Formatter] a new instance of Formatter
1372
+ #
1373
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#13
1374
+ def initialize(formatter:, logger:); end
1375
+
1376
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#35
1377
+ def __formatter; end
1378
+
1379
+ # source://forwardable/1.3.1/forwardable.rb#226
1380
+ def clear_tags!(*args, &block); end
1381
+
1382
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#19
1383
+ def current_tags; end
1384
+
1385
+ # source://forwardable/1.3.1/forwardable.rb#226
1386
+ def pop_tags(*args, &block); end
1387
+
1388
+ # source://forwardable/1.3.1/forwardable.rb#226
1389
+ def push_tags(*args, &block); end
1390
+
1391
+ # source://forwardable/1.3.1/forwardable.rb#226
1392
+ def tagged(*args, &block); end
1393
+
1394
+ # source://lumberjack//lib/lumberjack/tagged_logger_support.rb#28
1395
+ def tags_text; end
1396
+ end
1397
+
1398
+ # Monkey patch for ActiveSupport::TaggedLogger so it doesn't blow up when
1399
+ # a Lumberjack logger is trying to be wrapped. This module will be automatically
1400
+ # included in ActiveSupport::TaggedLogger if activesupport is already loaded.
1401
+ #
1402
+ # source://lumberjack//lib/lumberjack/tagged_logging.rb#7
1403
+ module Lumberjack::TaggedLogging
1404
+ mixes_in_class_methods ::Lumberjack::TaggedLogging::ClassMethods
1405
+
1406
+ class << self
1407
+ # @private
1408
+ #
1409
+ # source://lumberjack//lib/lumberjack/tagged_logging.rb#9
1410
+ def included(base); end
1411
+ end
1412
+ end
1413
+
1414
+ # source://lumberjack//lib/lumberjack/tagged_logging.rb#14
1415
+ module Lumberjack::TaggedLogging::ClassMethods
1416
+ # source://lumberjack//lib/lumberjack/tagged_logging.rb#15
1417
+ def new(logger); end
1418
+ end
1419
+
1420
+ # source://lumberjack//lib/lumberjack/tags.rb#4
1421
+ class Lumberjack::Tags
1422
+ class << self
1423
+ # Ensure keys are strings and expand any values in a hash that are Proc's by calling them and replacing
1424
+ # the value with the result. This allows setting global tags with runtime values.
1425
+ #
1426
+ # source://lumberjack//lib/lumberjack/tags.rb#25
1427
+ def expand_runtime_values(hash); end
1428
+
1429
+ # Transform hash keys to strings. This method exists for optimization and backward compatibility.
1430
+ # If a hash already has string keys, it will be returned as is.
1431
+ #
1432
+ # source://lumberjack//lib/lumberjack/tags.rb#8
1433
+ def stringify_keys(hash); end
1434
+ end
1435
+ end
1436
+
1437
+ # A template converts entries to strings. Templates can contain the following place holders to
1438
+ # reference log entry values:
1439
+ #
1440
+ # * :time
1441
+ # * :severity
1442
+ # * :progname
1443
+ # * :tags
1444
+ # * :message
1445
+ #
1446
+ # Any other words prefixed with a colon will be substituted with the value of the tag with that name.
1447
+ # If your tag name contains characters other than alpha numerics and the underscore, you must surround it
1448
+ # with curly brackets: `:{http.request-id}`.
1449
+ #
1450
+ # source://lumberjack//lib/lumberjack/template.rb#16
1451
+ class Lumberjack::Template
1452
+ # Create a new template from the markup. The +first_line+ argument is used to format only the first
1453
+ # line of a message. Additional lines will be added to the message unformatted. If you wish to format
1454
+ # the additional lines, use the :additional_lines options to specify a template. Note that you'll need
1455
+ # to provide the line separator character in this template if you want to keep the message on multiple lines.
1456
+ #
1457
+ # The time will be formatted as YYYY-MM-DDTHH:MM:SSS.SSS by default. If you wish to change the format, you
1458
+ # can specify the :time_format option which can be either a time format template as documented in
1459
+ # +Time#strftime+ or the values +:milliseconds+ or +:microseconds+ to use the standard format with the
1460
+ # specified precision.
1461
+ #
1462
+ # Messages will have white space stripped from both ends.
1463
+ #
1464
+ # @return [Template] a new instance of Template
1465
+ #
1466
+ # source://lumberjack//lib/lumberjack/template.rb#33
1467
+ def initialize(first_line, options = T.unsafe(nil)); end
1468
+
1469
+ # Convert an entry into a string using the template.
1470
+ #
1471
+ # source://lumberjack//lib/lumberjack/template.rb#56
1472
+ def call(entry); end
1473
+
1474
+ # source://lumberjack//lib/lumberjack/template.rb#51
1475
+ def datetime_format; end
1476
+
1477
+ # source://lumberjack//lib/lumberjack/template.rb#42
1478
+ def datetime_format=(format); end
1479
+
1480
+ private
1481
+
1482
+ # Compile the template string into a value that can be used with sprintf.
1483
+ #
1484
+ # source://lumberjack//lib/lumberjack/template.rb#106
1485
+ def compile(template); end
1486
+
1487
+ # source://lumberjack//lib/lumberjack/template.rb#86
1488
+ def tag_args(tags, tag_vars); end
1489
+ end
1490
+
1491
+ # source://lumberjack//lib/lumberjack/template.rb#19
1492
+ Lumberjack::Template::MICROSECOND_TIME_FORMAT = T.let(T.unsafe(nil), String)
1493
+
1494
+ # source://lumberjack//lib/lumberjack/template.rb#18
1495
+ Lumberjack::Template::MILLISECOND_TIME_FORMAT = T.let(T.unsafe(nil), String)
1496
+
1497
+ # source://lumberjack//lib/lumberjack/template.rb#20
1498
+ Lumberjack::Template::PLACEHOLDER_PATTERN = T.let(T.unsafe(nil), Regexp)
1499
+
1500
+ # source://lumberjack//lib/lumberjack/template.rb#17
1501
+ Lumberjack::Template::TEMPLATE_ARGUMENT_ORDER = T.let(T.unsafe(nil), Array)