ruby_smart-simple_logger 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +38 -0
  3. data/.gitignore +25 -0
  4. data/.rspec +3 -0
  5. data/.yardopts +5 -0
  6. data/Gemfile +7 -0
  7. data/README.md +739 -0
  8. data/Rakefile +8 -0
  9. data/bin/console +8 -0
  10. data/bin/setup +8 -0
  11. data/docs/CHANGELOG.md +17 -0
  12. data/docs/CODE_OF_CONDUCT.md +84 -0
  13. data/docs/LICENSE.txt +21 -0
  14. data/lib/debugger.rb +20 -0
  15. data/lib/ruby_smart/simple_logger/core_ext/ruby/string.rb +43 -0
  16. data/lib/ruby_smart/simple_logger/devices/memory_device.rb +43 -0
  17. data/lib/ruby_smart/simple_logger/devices/multi_device.rb +69 -0
  18. data/lib/ruby_smart/simple_logger/devices/proc_device.rb +37 -0
  19. data/lib/ruby_smart/simple_logger/extensions/helper.rb +259 -0
  20. data/lib/ruby_smart/simple_logger/extensions/logs.rb +26 -0
  21. data/lib/ruby_smart/simple_logger/extensions/mask.rb +53 -0
  22. data/lib/ruby_smart/simple_logger/extensions/scene.rb +77 -0
  23. data/lib/ruby_smart/simple_logger/extensions/severity.rb +62 -0
  24. data/lib/ruby_smart/simple_logger/extensions/simple_log.rb +224 -0
  25. data/lib/ruby_smart/simple_logger/extensions/timer.rb +63 -0
  26. data/lib/ruby_smart/simple_logger/formatter.rb +153 -0
  27. data/lib/ruby_smart/simple_logger/gem_version.rb +23 -0
  28. data/lib/ruby_smart/simple_logger/klass_logger.rb +45 -0
  29. data/lib/ruby_smart/simple_logger/logger.rb +74 -0
  30. data/lib/ruby_smart/simple_logger/scenes.rb +288 -0
  31. data/lib/ruby_smart/simple_logger/version.rb +12 -0
  32. data/lib/ruby_smart/simple_logger.rb +25 -0
  33. data/lib/ruby_smart-simple_logger.rb +3 -0
  34. data/lib/simple_logger.rb +7 -0
  35. data/ruby_smart-simple_logger.gemspec +43 -0
  36. metadata +167 -0
data/README.md ADDED
@@ -0,0 +1,739 @@
1
+ # RubySmart::SimpleLogger
2
+
3
+ [![GitHub](https://img.shields.io/badge/github-ruby--smart/simple_logger-blue.svg)](http://github.com/ruby-smart/simple_logger)
4
+ [![Documentation](https://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.info/gems/ruby_smart-simple_logger)
5
+
6
+ [![Gem Version](https://badge.fury.io/rb/ruby_smart-simple_logger.svg?kill_cache=1)](https://badge.fury.io/rb/ruby_smart-simple_logger)
7
+ [![License](https://img.shields.io/github/license/ruby-smart/simple_logger)](docs/LICENSE.txt)
8
+
9
+ [![Coverage Status](https://coveralls.io/repos/github/ruby-smart/simple_logger/badge.svg?branch=main&kill_cache=1)](https://coveralls.io/github/ruby-smart/simple_logger?branch=main)
10
+ [![Tests](https://github.com/ruby-smart/simple_logger/actions/workflows/ruby.yml/badge.svg)](https://github.com/ruby-smart/simple_logger/actions/workflows/ruby.yml)
11
+
12
+ A simple, multifunctional logging library for Ruby.
13
+ It features a fast, customizable logging with multi-device support (e.g. log to STDOUT AND file).
14
+ Special (PRE-defined) scenes can be used for interactive CLI and better logging visibility.
15
+
16
+ -----
17
+
18
+ ## Installation
19
+
20
+ Add this line to your application's Gemfile:
21
+
22
+ ```ruby
23
+ gem 'ruby_smart-simple_logger'
24
+ ```
25
+
26
+ And then execute:
27
+
28
+ $ bundle install
29
+
30
+ Or install it yourself as:
31
+
32
+ $ gem install ruby_smart-simple_logger
33
+
34
+ -----
35
+
36
+ ## Enhancements
37
+ * PRE-defined scenes to fastly create a simple, structured CLI output. _(see [Scenes](#scenes))_
38
+ * Better log-visibility with masked output through scenes
39
+ * ```awesome_print``` gem compatibility for a prettified object debug
40
+ * Multi-device support (write to logfile & to STDOUT & to ... & to ...)
41
+ * 'klass_logger' instances for easier access _(see [klass_logger](#klass_logger_Usage))_
42
+
43
+ -----
44
+
45
+ ## Examples
46
+
47
+ ```ruby
48
+ require 'simple_logger'
49
+
50
+ logger = ::SimpleLogger.new
51
+
52
+ logger.debug @my_custom_object, "test title"
53
+ # =========================================== [test title] ===========================================
54
+ # {
55
+ # :a => "hash",
56
+ # :with => {
57
+ # :example => :data
58
+ # }
59
+ # }
60
+ # ====================================================================================================
61
+ ```
62
+
63
+ ```ruby
64
+ logger = ::SimpleLogger.new(:memory)
65
+ logger.debug "some debug"
66
+ logger.info "some info"
67
+
68
+ # uses a new SUB-severity of INFO to handle with error / success logs
69
+ logger.success "success called"
70
+
71
+ logger.logs
72
+ # => [
73
+ # [:debug, 2022-07-07 10:58:35 +0200, "some debug"],
74
+ # [:info, 2022-07-07 10:58:35 +0200, "some info"],
75
+ # [:success, 2022-07-07 10:58:35 +0200, "success called"]
76
+ # ]
77
+ ```
78
+
79
+ ```ruby
80
+ require 'simple_logger'
81
+
82
+ logger = ::SimpleLogger.new
83
+
84
+ logger.theme "Jobs to do"
85
+ logger.job_result "A custom job", true
86
+ logger.job_result "A other job", "failed", false
87
+ logger.job_result "Just a job", "unknown", :yellow
88
+
89
+ # # Jobs to do
90
+ # -------------------------------------------------------------------------------------
91
+ # - A custom job => true
92
+ # - A other job => failed
93
+ # - Just a job => unknown
94
+ ```
95
+
96
+ -----
97
+
98
+ ## Usage
99
+
100
+ You can either create your own logger instance, by calling **new** on the ::SimpleLogger class or using the logger as a **klass_logger**.
101
+
102
+ ### Instance Usage
103
+
104
+ ```ruby
105
+ require 'simple_logger'
106
+
107
+ # providing no 'builtin' parameter will auto-detect the best logging solution
108
+ # - for CLI / windowed programs it'll send the logs to STDOUT.
109
+ # - for rails applications it'll forward all logs to the Rails logger.
110
+ # - otherwise it'll store the logs in memory
111
+ logger = ::SimpleLogger.new
112
+ logger.debug "some debug"
113
+ logger.error "that failed ..."
114
+
115
+ alternative_logger = ::SimpleLogger.new :memory
116
+ alternative_logger.debug "some debug, just in memory logs"
117
+ alternative_logger.error "that failed, also in memory logs..."
118
+
119
+ # access the logs as array
120
+ alternative_logger.logs
121
+ # => [[:debug, 2022-07-06 14:49:40 +0200, "some debug, just in memory logs"], [:error, 2022-07-06 14:49:40 +0200, "that failed, also in memory logs..."]]
122
+
123
+ # access the logs as grouped hash
124
+ alternative_logger.logs_to_h
125
+ #=> {:debug=>["some debug, just in memory logs"], :error=>["that failed, also in memory logs..."]}
126
+ ```
127
+ _You can also create a new instance from every klass_logger Object (see below)._
128
+
129
+ ### klass_logger Usage
130
+
131
+ Instead of creating a new instance you can also create klass_logger on every module by simply extending the `::SimpleLogger::KlassLogger` module.
132
+ ```ruby
133
+ module MyCustomLogger
134
+ extend ::RubySmart::SimpleLogger::KlassLogger
135
+
136
+ self.klass_logger_opts = {builtin: :stdout, clr: true}
137
+ end
138
+
139
+ MyCustomLogger.debug "some debug"
140
+ MyCustomLogger.error "that failed ...", "It's an error title for better visibility"
141
+ MyCustomLogger.theme "My Theme"
142
+
143
+ # log directly to a customized logfile - created through the builtin module name
144
+ MyCustomLogger.klass_logger_opts = {builtin: MyApp::Tasks::SpecialTask}
145
+ MyCustomLogger.clear!
146
+ MyCustomLogger.info "Very nice here"
147
+ # => creates a logfile @ log/my_app/tasks/special_task.log
148
+ ```
149
+
150
+ This is already done for the `SimpleLogger` module - so you can directly access the methods:
151
+ ```ruby
152
+ require 'simple_logger'
153
+
154
+ SimpleLogger.debug "some debug"
155
+ SimpleLogger.error "that failed ..."
156
+
157
+ # resetting options
158
+ SimpleLogger.klass_logger_opts = {builtin: :memory, stdout: false}
159
+ SimpleLogger.clear!
160
+
161
+ SimpleLogger.debug "some other debug in memory only ..."
162
+ SimpleLogger.logs
163
+
164
+ # create new logger from current SimpleLogger module
165
+ # this will also use the current 'klass_logger_opts', if no other opts are provided ...
166
+ other_logger = SimpleLogger.new
167
+ other_logger.debug "some other debug in memory only ..."
168
+
169
+ # create new logger, but don't use 'klass_logger_opts' - instead pipe to the rails logger
170
+ other_logger2 = SimpleLogger.new :rails
171
+ other_logger2.info "directly logs to the rails logger"
172
+ ```
173
+
174
+ -----
175
+
176
+ ## Builtins
177
+
178
+ While you can just build a new logger _(or use the klass_logger)_ without any arguments, you can also create a new one with builtins.
179
+
180
+ ### nil Builtin
181
+
182
+ A ```nil``` builtin will auto-detect the best logging solution for you.
183
+ For CLI or windowed programs it'll just send the logs to ```STDOUT```.
184
+ For rails-applications it'll send to the current ```Rails.logger``` instance.
185
+ Otherwise it'll store logs temporary in memory _(accessible through the #logs method)_
186
+
187
+ **Example:**
188
+ ```ruby
189
+ logger = ::SimpleLogger.new
190
+ logger.debug "some debug"
191
+ ```
192
+
193
+ ### stdout / stderr Builtin
194
+
195
+ A ```:stdout / :stderr``` builtin will send to ```STDOUT / STDERR``` and uses a colored output by default.
196
+
197
+ **Example:**
198
+ ```ruby
199
+ logger = ::SimpleLogger.new(:stdout)
200
+
201
+ # creates a nice debug output (by default)
202
+ # ============================================== [Debug] =============================================
203
+ # "some debug"
204
+ # ====================================================================================================
205
+ logger.debug "some debug"
206
+ ```
207
+
208
+ ### rails Builtin
209
+
210
+ A ```:rails``` builtin will always send to the ```Rails.logger``` instance.
211
+
212
+ **Example:**
213
+ ```ruby
214
+ logger = ::SimpleLogger.new(:rails)
215
+
216
+ # sends data to the Rails.logger
217
+ logger.debug "some debug"
218
+ ```
219
+
220
+ ### proc Builtin
221
+
222
+ A ```:proc``` builtin will call the provided proc _(through ```options[:proc]```)_ everytime a log will be written.
223
+
224
+ The data will be provided as array _( ```[severity, time, progname, data]``` )_.
225
+
226
+ **Example:**
227
+ ```ruby
228
+ proc = lambda{|data| puts "---> #{data[0]} | #{data[3]} <---"}
229
+
230
+ logger = ::SimpleLogger.new(:proc, proc: proc)
231
+
232
+ # calls the proc with data-array
233
+ # => ---> DEBUG | some debug <---
234
+ logger.debug "some debug"
235
+ ```
236
+
237
+ ### memory Builtin
238
+
239
+ A ```:memory``` builtin will always store the logged data within an _instance variable_ and can be accessed through the ```#logs``` or ```#logs_to_h``` methods.
240
+
241
+ **Example:**
242
+ ```ruby
243
+ logger = ::SimpleLogger.new(:memory)
244
+ logger.debug "some debug"
245
+ logger.info "some info"
246
+
247
+ # uses a new SUB-severity of INFO to handle with error / success logs
248
+ logger.success "success called"
249
+
250
+ logger.logs
251
+ # => [
252
+ # [:debug, 2022-07-07 10:58:35 +0200, "some debug"],
253
+ # [:info, 2022-07-07 10:58:35 +0200, "some info"],
254
+ # [:success, 2022-07-07 10:58:35 +0200, "success called"]
255
+ # ]
256
+ ```
257
+
258
+ ### String Builtin
259
+
260
+ Providing a ```String``` will always create and write to a new logfile.
261
+
262
+ **Example:**
263
+ ```ruby
264
+ # creates a new logfile @ log/a_custom/logfile.log
265
+ # IMPORTANT: I'll also create a colored, masked output by default and uses the awesome_print pretty debug...
266
+ #
267
+ # # Logfile created on 2022-07-07 11:01:27 +0200 by logger.rb/66358
268
+ # [1;34m============================================== [Debug] =============================================
269
+ # [0;33m"some debug"
270
+ # [1;34m====================================================================================================
271
+ logger = ::SimpleLogger.new('a_custom/logfile.log')
272
+ logger.debug "some debug"
273
+
274
+
275
+ # creates a new logfile @ log/a_custom/other_logfile.log
276
+ # Does NOT create a colored output and prevent inspection (e.g. by awesome_print)
277
+ #
278
+ # Logfile created on 2022-07-07 11:04:17 +0200 by logger.rb/66358
279
+ # ============================================== [Debug] =============================================
280
+ # some debug without color, but with mask
281
+ # ====================================================================================================
282
+ other_logger = ::SimpleLogger.new('a_custom/other_logfile.log', clr: false, inspect: false)
283
+ other_logger.debug "some debug without color, but with mask"
284
+
285
+
286
+ # creates a new logfile @ log/a_custom/noformat_logfile.log
287
+ # Prevents logs with masks (or other payloads)
288
+ #
289
+ # # Logfile created on 2022-07-07 11:34:38 +0200 by logger.rb/66358
290
+ # D, [2022-07-07T11:34:39.056395 #23253] DEBUG -- : some debug without color and mask - uses the default format
291
+ noformat_logger = ::SimpleLogger.new('a_custom/noformat_logfile.log', format: :default, payload: false)
292
+ noformat_logger.debug "some debug without color and mask - uses the default format"
293
+ ```
294
+
295
+ ### Module Builtin
296
+
297
+ Providing a ```Module``` will also create and write to a new logfile.
298
+ The path depends on the provided module name.
299
+
300
+ **Example:**
301
+ ```ruby
302
+ # creates a new logfile @ log/users/jobs/import.log
303
+ # IMPORTANT: I'll also create a colored, masked output by default and uses the awesome_print pretty debug...
304
+ #
305
+ # # Logfile created on 2022-07-07 11:01:27 +0200 by logger.rb/66358
306
+ # [1;34m============================================== [Debug] =============================================
307
+ # [0;33m"some debug"
308
+ # [1;34m====================================================================================================
309
+ logger = ::SimpleLogger.new(Users::Jobs::Import)
310
+ logger.debug "some debug"
311
+ ```
312
+
313
+ ### other Builtin
314
+
315
+ Providing any other Object must respond to ```#write```.
316
+
317
+ -----
318
+
319
+ ## Formats
320
+
321
+ The default formatter _(if no other was provided through ```opts[:formatter```)_ will provide the following PRE-defined formats:
322
+ _Also prints a colored output by default._
323
+
324
+ ### default Format
325
+
326
+ The **default** format equals the Ruby's Formatter - by default also prints a colored output:
327
+
328
+ ```ruby
329
+ logger = ::SimpleLogger.new(:stdout, format: :default, payload: false)
330
+
331
+ # D, [2022-07-07T12:22:16.364920 #27527] DEBUG -- : debug message
332
+ logger.debug "debug message"
333
+ ```
334
+
335
+ ### passthrough Format
336
+
337
+ The **passthrough** format is mostly used to just 'passthrough' all args to the device _(proc, memory, file, etc.)_ without formatting anything.
338
+ This will just provide an array of args.
339
+
340
+ ```ruby
341
+ logger = ::SimpleLogger.new(:stdout, format: :passthrough, payload: false)
342
+
343
+ # ["DEBUG", 2022-07-07 12:25:59 +0200, nil, "debug message"]
344
+ logger.debug "debug message"
345
+ ```
346
+
347
+ ### plain Format
348
+
349
+ The **plain** format is only used to forward the provided **data**, without severity, time, etc.
350
+ This is the default behaviour of the SimpleLogger - which is used to build `scene`, masks, ...
351
+
352
+ ```ruby
353
+ logger = ::SimpleLogger.new(:stdout, format: :plain, payload: false)
354
+
355
+ # debug message
356
+ logger.debug "debug message"
357
+
358
+ # with payload
359
+ payload_logger = ::SimpleLogger.new(:stdout, format: :plain)
360
+
361
+ # ============================================== [Debug] =============================================
362
+ # "debug message"
363
+ # ====================================================================================================
364
+ payload_logger.debug "debug message"
365
+ ```
366
+
367
+ ### memory Format
368
+
369
+ The **memory** format is only used by the memory-device to store severity, time & data as an array.
370
+
371
+ ```ruby
372
+ logger = ::SimpleLogger.new(:stdout, format: :memory, payload: false)
373
+
374
+ # [:debug, 2022-07-07 12:31:19 +0200, "debug message"]
375
+ logger.debug "debug message"
376
+ ```
377
+
378
+ ### datalog Format
379
+
380
+ The **datalog** format is used to store every log in a structured data.
381
+ For datalogs the colored output should also be disabled!
382
+
383
+ ```ruby
384
+ logger = ::SimpleLogger.new(:stdout, format: :datalog, payload: false, clr: false)
385
+
386
+ # [ DEBUG] [2022-07-07 12:31:43] [#27527] [debug message]
387
+ logger.debug "debug message"
388
+ ```
389
+
390
+ -----
391
+
392
+ ## Options
393
+
394
+ Independent of the **builtins** you can still provide custom options for the logger:
395
+
396
+ ### device
397
+
398
+ Provide a custom device.
399
+ ```ruby
400
+ logger = ::SimpleLogger.new(device: @my_custom_device)
401
+
402
+ # same like above
403
+ logger = ::SimpleLogger.new(@my_custom_device)
404
+ ```
405
+
406
+ ### clr
407
+
408
+ Disable colored output.
409
+ ```ruby
410
+ logger = ::SimpleLogger.new(clr: false)
411
+ logger = ::SimpleLogger.new(:stdout, clr: false)
412
+ ```
413
+
414
+ ### payload
415
+
416
+ Disable payloads _(from scenes)_.
417
+ ```ruby
418
+ logger = ::SimpleLogger.new(payload: false)
419
+ logger = ::SimpleLogger.new(:stdout, payload: false)
420
+ ```
421
+
422
+ ### format _(for default formatter ONLY)_
423
+
424
+ Provide a other format.
425
+ Possible values: ```:default, :passthrough, :plain, :memory, :datalog```
426
+ ```ruby
427
+ logger = ::SimpleLogger.new(format: :default)
428
+ logger = ::SimpleLogger.new(:memory, format: :passthrough)
429
+ ```
430
+
431
+ ### nl _(for default formatter ONLY)_
432
+
433
+ Enable / disable NewLine for formatter.
434
+ ```ruby
435
+ logger = ::SimpleLogger.new(format: :default, nl: false, payload: false, clr: false)
436
+ logger.debug "debug 1"
437
+ logger.debug "debug 2"
438
+ # D, [2022-07-07T13:42:25.323359 #32139] DEBUG -- : debug 1D, [2022-07-07T13:42:25.323501 #32139] DEBUG -- : debug 2
439
+ ```
440
+
441
+ ### proc _(:proc-builtin ONLY)_
442
+
443
+ Provide a callback for the ```:proc``` builtin.
444
+ ```ruby
445
+ logger = ::SimpleLogger.new(:proc, proc: lambda{|data| ... })
446
+ ```
447
+
448
+ ### stdout _(:memory-builtin ONLY)_
449
+
450
+ Enable STDOUT as MultiDevice for the memory builtin.
451
+ ```ruby
452
+ logger = ::SimpleLogger.new(:memory, stdout: true)
453
+
454
+ # same as above
455
+ logger = ::SimpleLogger.new(
456
+ ::SimpleLogger::Devices::MultiDevice.new.
457
+ register(::SimpleLogger::Devices::MemoryDevice.new, ::SimpleLogger::Formatter.new(format: :memory, nl: false)).
458
+ register(STDOUT, ::SimpleLogger::Formatter.new(format: :default, nl: true, clr: (opts[:clr] != nil)))
459
+ )
460
+ ```
461
+
462
+ ### mask
463
+
464
+ Provide custom mask options.
465
+ ```ruby
466
+ logger = ::SimpleLogger.new(mask: { char: '#', length: 50, clr: :purple })
467
+ logger.debug "debug text"
468
+ # ##################### [Debug] ####################
469
+ # "debug text"
470
+ # ##################################################
471
+ ```
472
+
473
+ ### level
474
+
475
+ Change the severity level.
476
+ ```ruby
477
+ logger = ::SimpleLogger.new(level: :info)
478
+ logger.debug "debug text"
479
+ # => false
480
+
481
+ logger.info "info text"
482
+ # ============================================== [Info] ==============================================
483
+ # info text
484
+ # ====================================================================================================
485
+ ```
486
+
487
+ ### formatter
488
+
489
+ Provide a custom formatter instance.
490
+ ```ruby
491
+ logger = ::SimpleLogger.new(formatter: My::Custom::Formatter.new)
492
+ ```
493
+
494
+ ### clr
495
+
496
+ Disable color for payload and formatter.
497
+
498
+ ```ruby
499
+ logger = ::SimpleLogger.new(clr: false)
500
+ ```
501
+
502
+ ### payload
503
+
504
+ Disable payload _(mask & scenes)_ for logger
505
+
506
+ ```ruby
507
+ logger = ::SimpleLogger.new(payload: false)
508
+ logger.debug "some debug without payload"
509
+ # some debug without payload
510
+ ```
511
+
512
+ ### inspect
513
+
514
+ Disable inspect for logger
515
+
516
+ ```ruby
517
+ logger = ::SimpleLogger.new(inspect: false)
518
+ logger.debug({a: {custom: 'object'}})
519
+ # {:a => { :custom => "object" } }
520
+ ```
521
+
522
+ ### inspector
523
+
524
+ Provide a other ```inspector``` method for the data-debug.
525
+
526
+ ```ruby
527
+ logger = ::SimpleLogger.new(inspector: :to_s)
528
+ logger.debug({ a: 1, b: 2 })
529
+ # some debug without inspector
530
+ # ============================================== [Debug] =============================================
531
+ # {:a=>1, :b=>2}
532
+ # ====================================================================================================
533
+ ```
534
+
535
+ ## _defaults_
536
+
537
+ Logger default options are still available: ```shift_age, shift_size, progname, datetime_format, shift_period_suffix```
538
+
539
+ -----
540
+
541
+ ## Scenes
542
+
543
+ The following PRE-defined scenes are available. _(You can define your own scenes by using the class method ```.scene```)_
544
+
545
+ ### debug(data, subject = 'Debug')
546
+ ```ruby
547
+ # debug method
548
+ # severity: debug
549
+ # prints: prettified data by using the 'inspect' method
550
+ #
551
+ # > ================================================= [Debug] ================================================
552
+ # > "DEBUGGED DATA" <- analyzed by awesome_print#ai method
553
+ # > ==========================================================================================================
554
+ ```
555
+
556
+ ### info, warn, error, fatal, success (data, subject = 'name')
557
+ ```ruby
558
+ # info method (BASE)
559
+ # severity: methods name
560
+ # prints: enclosed data
561
+ #
562
+ # > ================================================= [Info] =================================================
563
+ # > DATA
564
+ # > ==========================================================================================================
565
+ ```
566
+
567
+ ### header(subject)
568
+ ```ruby
569
+ # header method
570
+ # severity: debug
571
+ # prints: prettified subject
572
+ #
573
+ # > ===========================================================================================================
574
+ # > ================================================ <Subject> ================================================
575
+ # > ===========================================================================================================
576
+ ```
577
+
578
+ ### footer(subject)
579
+ ```ruby
580
+ # footer method
581
+ # severity: debug
582
+ # prints: prettified subject
583
+ #
584
+ # > ===========================================================================================================
585
+ # > ================================================ >Subject< ================================================
586
+ # > ===========================================================================================================
587
+ ```
588
+
589
+ ### topic(subject)
590
+ ```ruby
591
+ # topic method
592
+ # severity: debug
593
+ # prints: prettified subject
594
+ #
595
+ # > --------------------------------------------------------------------------------
596
+ # > #----------------------------------- Subject ----------------------------------#
597
+ ```
598
+
599
+ ### theme(subject)
600
+ ```ruby
601
+ # theme method
602
+ # severity: debug
603
+ # prints: prettified, colored subject
604
+ #
605
+ # > # Subject
606
+ # > ----------------------------------------------------------------------
607
+ ```
608
+
609
+ ### theme_result(result, status = nil)
610
+ ```ruby
611
+ # theme_result method
612
+ # severity: debug
613
+ # prints: prettified, colored result
614
+ #
615
+ # > ----------------------------------------------------------------------
616
+ # > -> Result
617
+ # >
618
+ ```
619
+
620
+ ### theme_line
621
+ ```ruby
622
+ # theme_line method
623
+ # severity: debug
624
+ # prints: colored line with no text
625
+ #
626
+ # > ----------------------------------------------------------------------
627
+ ```
628
+
629
+ ### desc(description)
630
+ ```ruby
631
+ # desc method
632
+ # severity: debug
633
+ # prints: colored text
634
+ #
635
+ # > "description"
636
+ # >
637
+ ```
638
+
639
+ ### job(name)
640
+ ```ruby
641
+ # job method
642
+ # severity: debug
643
+ # prints: colored line with job name (on inline formatter it prevents a line-break)
644
+ # calls the result method if a block was provided
645
+ #
646
+ # > - Job name =>
647
+ # ________________________________________________________________ <- 64 chars
648
+ ```
649
+
650
+ ### sub_job(name)
651
+ ```ruby
652
+ # sub_job method
653
+ # severity: debug
654
+ # prints: line with job name (on inline formatter it prevents a line-break)
655
+ # calls the result method if a block was provided
656
+ #
657
+ # > * Subjob name =>
658
+ # ______________________________________________________________ <- 62 chars
659
+ ```
660
+
661
+ ### result(result, status = nil)
662
+ ```ruby
663
+ # result method
664
+ # severity: debug
665
+ # prints: colored result
666
+ #
667
+ # > Result
668
+ ```
669
+
670
+ ### job_result(name, result, status = nil)
671
+ ```ruby
672
+ # job_result method
673
+ # severity: debug
674
+ # prints: job with combined colored result
675
+ #
676
+ # > - Job name => Result
677
+ ```
678
+
679
+ ### sub_job_result(name, result, status = nil)
680
+ ```ruby
681
+ # sub_job_result method
682
+ # severity: debug
683
+ # prints: sub_job with combined colored result
684
+ #
685
+ # > * Subjob name => Result
686
+ ```
687
+
688
+ ### spec(status)
689
+ ```ruby
690
+ # spec method
691
+ # severity: debug
692
+ # prints: colored spec result string - depending on the status (on inline formatter it prevents a line-break)
693
+ #
694
+ # true => . (green)
695
+ # false => F (red)
696
+ # "other" => ? (yellow)
697
+ #
698
+ # > .FFF...??...F....F...F..???....F...??
699
+ ```
700
+
701
+ ### progress(name, perc)
702
+ ```ruby
703
+ # progress method
704
+ # severity: debug
705
+ # prints: colored progress indicator
706
+ #
707
+ # > - Progress of Step 0 [ 0%] >-------------------------------------------------
708
+ # > - Progress of Step 1 [ 40%] ===================>------------------------------
709
+ #
710
+ # ________________________________________________ <- 48 chars
711
+ # 50 chars -> __________________________________________________
712
+ ```
713
+
714
+ ### _other useful methods_
715
+
716
+ - line
717
+ - print
718
+ - nl
719
+
720
+ -----
721
+
722
+ ## Docs
723
+
724
+ [CHANGELOG](docs/CHANGELOG.md)
725
+
726
+ ## Contributing
727
+
728
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/ruby-smart/simple_logger).
729
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](docs/CODE_OF_CONDUCT.md).
730
+
731
+ ## License
732
+
733
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
734
+
735
+ A copy of the [LICENSE](docs/LICENSE.txt) can be found @ the docs.
736
+
737
+ ## Code of Conduct
738
+
739
+ Everyone interacting in the project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [CODE OF CONDUCT](docs/CODE_OF_CONDUCT.md).