chili_logger 0.0.8 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +455 -119
- data/chili_logger.gemspec +1 -1
- data/lib/brokers/rabbit_broker.rb +2 -12
- data/lib/brokers/sqs_broker.rb +1 -1
- data/lib/chili_logger/version.rb +1 -1
- data/lib/current_log_accessor.rb +0 -1
- data/log/chili-logger-coverage.yml +99 -0
- metadata +6 -13
- data/chili_logger-0.0.6.gem +0 -0
- data/chili_logger-0.0.7.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c91c57ffcdb641479b3174ea6ad523c976d6668f4fe049025d51bcd0574e716a
|
4
|
+
data.tar.gz: d57923238e3c0bba29cc00b209ee30f3b8eaa4e026553d3cae6a1b4586072fef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94ef9e11202aff8cc8fa0039eaeb3a758de300cf1913ce20b3536b1187ed931a3bc00f05ff6571e51d3d6d22eeb6d40496b0454f5709f8b8228acfe6d0eeee6d
|
7
|
+
data.tar.gz: 7091ca4a4be36329d7a7e426cc4a1fbb8b0bd9ac67938677fd6fd5fe71295bf8d7f695666987c7755fdee2b254abd62b4607979eb1fbdcf603a45be79c85c7ab
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,30 +24,38 @@ ChiliLogger is a gem developed by Chiligum Creatives for internal use. It is use
|
|
24
24
|
* [Putting It All Together](####putting-it-all-together)
|
25
25
|
* [Installation](##installation)
|
26
26
|
* [Basic Usage](##basic-usage)
|
27
|
+
* [publish_instant_log params](####publish_instant_log-params)
|
28
|
+
* [publish_instant_log usage example](####publish_instant_log-usage-example)
|
29
|
+
* [publish_instant_log default argument values](####publish_instant_log-default-argument-values)
|
30
|
+
* [ChiliLogger's Singleton pattern](####ChiliLoggers-singleton-pattern)
|
27
31
|
* [Advanced Usage](##advanced-usage)
|
28
32
|
* [Code Example](####advanced-code-example)
|
29
33
|
* [Error Logging](####error-logging)
|
30
34
|
* [Customizing a Started Log](####customizing-a-started-log)
|
31
35
|
* [Accessing the current_log](####accessing-the-current_log)
|
32
36
|
* [user](####user)
|
33
|
-
* [
|
37
|
+
* [update_user](####update_user)
|
34
38
|
* [desc](####desc)
|
35
|
-
* [
|
36
|
-
* [
|
37
|
-
* [
|
38
|
-
* [
|
39
|
+
* [update_type](####update_type)
|
40
|
+
* [update_service](####update_service)
|
41
|
+
* [update_action](####update_action)
|
42
|
+
* [update_desc](####update_desc)
|
39
43
|
* [main_content](####main_content)
|
40
|
-
* [
|
44
|
+
* [update_main_content](####update_main_content)
|
41
45
|
* [add_to_main_content](####add_to_main_content)
|
42
46
|
* [modified_records](####modified_records)
|
43
|
-
* [
|
47
|
+
* [update_modified_records](####update_modified_records)
|
44
48
|
* [add_modified_record](####add_modified_record)
|
45
49
|
* [clear_log_info](####clear_log_info)
|
46
|
-
* [
|
50
|
+
* [Snippets For Quicker Logging](##snippets-for-quicker-logging)
|
47
51
|
* [Papertrail Optional Use](###papertrail-optional-use)
|
48
|
-
* [Logging Transactions](###logging-transactions)
|
52
|
+
* [Logging Transactions in HTP Requests](###logging-transactions-in-http-requests)
|
53
|
+
* [Controllers](####controllers-logging-logic)
|
54
|
+
* [Models](####models-logging-logic)
|
49
55
|
* [Logging Rake Tasks](###logging-rake-tasks)
|
50
|
-
|
56
|
+
* [Logging Uncaught task Errors](####logging-uncaught-task-errors)
|
57
|
+
* [Logging Transactions in Tasks](####logging-transactions-in-tasks)
|
58
|
+
* [Logging Heartbeats in Tasks](####logging-heartbeats-in-tasks)
|
51
59
|
* [Coverage](##Coverage)
|
52
60
|
|
53
61
|
## READ BEFORE CONTRIBUTING
|
@@ -117,11 +125,13 @@ The ChiliLogger gem was created to guarantee some level of uniformization in log
|
|
117
125
|
"email": 'exemple@test.com',
|
118
126
|
"company_cognito_id": "75",
|
119
127
|
"company_name": "Chiligum Creatives",
|
120
|
-
"
|
128
|
+
"ghost_user_cognito_id": "not_specified"
|
121
129
|
},
|
122
130
|
"transaction": {
|
123
131
|
"modified_records": {
|
124
|
-
"videos": [{ "id": 42, "title": 'Lateralus' }]
|
132
|
+
"videos": [{ "id": 42, "title": 'Lateralus' }],
|
133
|
+
"gallery_tags": [{ "id": 50 }, { "id": 51 }, { "id": 52 }],
|
134
|
+
"tags": [{ "id": 23, "name": "tool" }]
|
125
135
|
},
|
126
136
|
"errors": [],
|
127
137
|
"backtrace": [
|
@@ -189,12 +199,15 @@ The `user` stores the main infos about the user whose request generated the log.
|
|
189
199
|
#### Main Content
|
190
200
|
##### (Transaction | Error)
|
191
201
|
The `main_content` will have all other data relevant to the log. The main content of a log will be stored in a key with the same name as the log `type`. So a transaction log, as in the example above, willhave its main_content stored in the `transaction` field. In an error log, it would be in an `error` field.
|
192
|
-
|
202
|
+
It is an object with that accepts the folowwing attributes:
|
203
|
+
- `modified_records`, listing all tables modified and the records themselves;
|
204
|
+
- `errors`, listing errors found during the transaction and will usually be an empty array if the transaction was successful;
|
205
|
+
- `backtrace`, automatically created by the gem itself and showing the backtrace of the transaction and its processing;
|
193
206
|
|
194
207
|
---
|
195
208
|
|
196
209
|
#### Ops Metadata
|
197
|
-
Based on the configuration data(`:server_url`, `:cloud_provider`) that is passed to ChiliLogger when it is initialized, the log will also have metadata about the server itself where the application is running.
|
210
|
+
Based on the configuration data(`:server_url`, `:cloud_provider`) that is passed to ChiliLogger when it is initialized, the log will also have metadata about the server itself where the application is running.
|
198
211
|
|
199
212
|
---
|
200
213
|
|
@@ -249,6 +262,7 @@ Add this line to your application's Gemfile:
|
|
249
262
|
gem 'chili_logger'
|
250
263
|
```
|
251
264
|
|
265
|
+
#### Basic Initialization
|
252
266
|
|
253
267
|
Create a initializer file and configure ChiliLogger passing all the relevant information. It is recommended to deactivate ChiliLogger when running tests:
|
254
268
|
|
@@ -289,8 +303,27 @@ You ALSO MUST set `fallback_broker` and `fallback_broker_config`. This is the fa
|
|
289
303
|
|
290
304
|
Please note that if ChiliLogger tries to publish a log and both the configured Message Broker and the Error Handler are simultaneously down, the log will be discarded. This behavior makes sure logging problems never cause the app to break.
|
291
305
|
|
306
|
+
#### Overwriting RabbitMQ's routing_key
|
307
|
+
The [routing_key for all messages sent to rabbit will be created based on the description tag of the log](####description). But, sometimes, specially when testing, you may want to force all messages to be sent with a hardcoded routing_key. In those cases, you can add an optional field to the msg_broker_config: `routing_key_overwriter`.
|
308
|
+
```ruby
|
309
|
+
ChiliLogger.instance.config({
|
310
|
+
...
|
311
|
+
msg_broker_name: :rabbitmq,
|
312
|
+
msg_broker_config: {
|
313
|
+
user: ENV['RABBIT_USER'],
|
314
|
+
password: ENV['RABBIT_PASSWORD'],
|
315
|
+
ip: ENV['RABBIT_IP'],
|
316
|
+
port: ENV['RABBIT_PORT'],
|
317
|
+
exchange_name: ENV['RABBIT_EXCHANGE'],
|
318
|
+
routing_key_overwriter: 'a.hardcoded.routing.key'
|
319
|
+
},
|
320
|
+
...
|
321
|
+
})
|
322
|
+
```
|
292
323
|
|
293
324
|
## Basic Usage
|
325
|
+
|
326
|
+
#### publish_instant_log params
|
294
327
|
The easiest way to use ChiliLogger is with the `publish_instant_log` method. It requires a hash with the following optional attributes:
|
295
328
|
```ruby
|
296
329
|
{
|
@@ -304,7 +337,7 @@ The easiest way to use ChiliLogger is with the `publish_instant_log` method. It
|
|
304
337
|
email: 'example@chiligumvideos.com', # String
|
305
338
|
company_cognito_id: 88, # String || Fixnum || Bignum -> ChiliLogger converts company_cognito_id fields with these types to Strings
|
306
339
|
company_name: 'Chiligum', # String
|
307
|
-
|
340
|
+
ghost_user_cognito_id: 420, # String || Fixnum || Bignum -> ChiliLogger converts ghost_user_cognito_id with these types to Strings
|
308
341
|
},
|
309
342
|
main_content: { # Hash
|
310
343
|
modified_records: { # Hash
|
@@ -326,22 +359,31 @@ The easiest way to use ChiliLogger is with the `publish_instant_log` method. It
|
|
326
359
|
```
|
327
360
|
`desc` is used for setting the log's [type](###type), [service](###service), and [action](###action). env and layer were already set when ChiliLogger was [initialized and configured](##installation). Only `type`, `service`, and `action` are accepted.
|
328
361
|
|
329
|
-
`user` will set the user data. Only `cognito_id`, `email`, `company_cognito_id`, `company_name`, and `
|
362
|
+
`user` will set the user data. Only `cognito_id`, `email`, `company_cognito_id`, `company_name`, and `ghost_user_cognito_id` are accepted.
|
330
363
|
|
331
364
|
`main_content` will set the main information the log is concerned about. It only accepts `modified_records` or `errors`.
|
332
365
|
|
333
|
-
These fields must be set with the appropriate primitive types, as specified above. Not doing so [may create invalid logs](##read-before-contributing). ChiliLogger tries its best to enforce that all fields in a log will have consistent primitive types.
|
366
|
+
These fields must be set with the appropriate primitive types, as specified above. Not doing so [may create invalid logs](##read-before-contributing). Because of that, ChiliLogger tries its best to enforce that all fields in a log will have consistent primitive types.
|
367
|
+
|
334
368
|
|
369
|
+
#### publish_instant_log usage example
|
335
370
|
```ruby
|
336
371
|
desc = { type: 'transaction', service: 'videos', action: 'create' }
|
337
|
-
|
372
|
+
user = {
|
373
|
+
cognito_id: 88,
|
374
|
+
email: 'exemple@test.com',
|
375
|
+
company_cognito_id: 75,
|
376
|
+
company_name: "Chiligum Creatives",
|
377
|
+
ghost_user_cognito_id: 55
|
378
|
+
},
|
338
379
|
main_content = {
|
339
380
|
modified_records: {
|
381
|
+
# notice we have a key 'videos' (the SQS tablename) pointing to an array of hashes
|
340
382
|
videos: [{ id: 42, title: 'Lateralus' }]
|
341
383
|
}
|
342
384
|
}
|
343
385
|
|
344
|
-
ChiliLogger.instance.publish_instant_log(desc,
|
386
|
+
ChiliLogger.instance.publish_instant_log(desc: desc, user: user, main_content: main_content)
|
345
387
|
# publishes a json like this:
|
346
388
|
{
|
347
389
|
"env": "development",
|
@@ -350,15 +392,12 @@ ChiliLogger.instance.publish_instant_log(desc, agent, main_content)
|
|
350
392
|
"service": "videos",
|
351
393
|
"action": "create",
|
352
394
|
"desc": "development.creatives.transaction.videos.create",
|
353
|
-
"
|
354
|
-
"
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
"
|
359
|
-
"id": 75,
|
360
|
-
"name": 'Chiligum'
|
361
|
-
}
|
395
|
+
"user": {
|
396
|
+
"cognito_id": "88",
|
397
|
+
"email": 'exemple@test.com',
|
398
|
+
"company_cognito_id": "75",
|
399
|
+
"company_name": "Chiligum Creatives",
|
400
|
+
"ghost_user_cognito_id": "55"
|
362
401
|
},
|
363
402
|
"transaction": {
|
364
403
|
"modified_records": {
|
@@ -375,7 +414,8 @@ ChiliLogger.instance.publish_instant_log(desc, agent, main_content)
|
|
375
414
|
}
|
376
415
|
```
|
377
416
|
|
378
|
-
|
417
|
+
#### publish_instant_log default argument values
|
418
|
+
Passing `desc`, `agent`, and `main_content` is optional, since all of them have default values. This is so ChiliLogger is resiliant and doesn't break if any of these arguments is forgotten. But notice that their default values are not very descriptive and it results in low-quality, almost useless logs:
|
379
419
|
|
380
420
|
```ruby
|
381
421
|
ChiliLogger.instance.publish_instant_log
|
@@ -387,7 +427,13 @@ ChiliLogger.instance.publish_instant_log
|
|
387
427
|
"type": "not_specified",
|
388
428
|
"service": "not_specified",
|
389
429
|
"desc": "development.creatives.not_specified.not_specified.not_specified",
|
390
|
-
"
|
430
|
+
"user": {
|
431
|
+
"cognito_id": 'not_specified',
|
432
|
+
"email": 'not_specified',
|
433
|
+
"company_cognito_id": 'not_specified',
|
434
|
+
"company_name": 'not_specified',
|
435
|
+
"ghost_user_cognito_id": 'not_specified'
|
436
|
+
},
|
391
437
|
"not_specified": {},
|
392
438
|
"backtrace": [
|
393
439
|
"app/views/dashboard/controllers/videos_controller.rb:17 in block 'create'"
|
@@ -399,7 +445,7 @@ ChiliLogger.instance.publish_instant_log
|
|
399
445
|
"timestamp": "2020-06-30T18:08:59-03:00",
|
400
446
|
}
|
401
447
|
```
|
402
|
-
|
448
|
+
#### ChiliLogger's Singleton pattern
|
403
449
|
Notice that ChiliLogger uses the Singleton pattern. So, to call its methods, you must first access the instance method. Calling ChiliLogger.new will return an error:
|
404
450
|
```ruby
|
405
451
|
ChiliLogger.publish_instant_log(desc, agent, log)
|
@@ -482,7 +528,7 @@ end
|
|
482
528
|
|
483
529
|
Notice that the log is started in VideosController#create with some initial info about the agent user and the log description; following, the same log has its main_content customized in Video.add_modified_record_to_log, by accessing ChiliLogger's `current_log` and calling its `add_modified_record` method. And, afterwards, the same log is finished and published with `current_log.publish`, again in VideosController#create.
|
484
530
|
|
485
|
-
Check the [
|
531
|
+
Check the [Snippets For Quick Logging](##snippets-for-quick-logging) section to see how this functionality can be used to quickly set an all-embracing logging system for your application.
|
486
532
|
|
487
533
|
#### Error Logging
|
488
534
|
The controller code above could be improved by adding some logic to log unexpected errors:
|
@@ -501,7 +547,7 @@ class VideosController
|
|
501
547
|
rescue StandardError => error
|
502
548
|
#changes log type and publishes it
|
503
549
|
current_log.add_to_main_content({ error: error.as_json })
|
504
|
-
current_log.
|
550
|
+
current_log.update_type('uncaught_error')
|
505
551
|
current_log.publish
|
506
552
|
end
|
507
553
|
end
|
@@ -513,29 +559,32 @@ Once a log is started, its main attributes can be customized by accessing the `c
|
|
513
559
|
#### Accessing the current_log
|
514
560
|
```ruby
|
515
561
|
current_log = ChiliLogger.instance.current_log
|
516
|
-
current_log.
|
517
|
-
current_log.
|
562
|
+
current_log.user # returns currently set user
|
563
|
+
current_log.update_user(cognito_id: '42', company_name: 'Chiligum') # updates user data
|
518
564
|
```
|
519
|
-
####
|
520
|
-
returns log's currently set
|
565
|
+
#### user
|
566
|
+
returns log's currently set user
|
521
567
|
|
522
568
|
```ruby
|
523
|
-
current_log.
|
524
|
-
# {
|
569
|
+
current_log.user
|
570
|
+
# { cognito_id: 'not_specified', email: 'not_specified', company_cognito_id: 'not_specified',
|
571
|
+
# company_name: 'not_specified', ghost_user_cognito_id: 'not_specified' }
|
525
572
|
```
|
526
573
|
|
527
574
|
---
|
528
575
|
|
529
|
-
####
|
530
|
-
|
576
|
+
#### update_user
|
577
|
+
updates the currently set user
|
531
578
|
|
532
579
|
```ruby
|
533
|
-
current_log.
|
534
|
-
# {
|
535
|
-
|
536
|
-
|
537
|
-
current_log.
|
538
|
-
|
580
|
+
current_log.user
|
581
|
+
# { cognito_id: 'not_specified', email: 'not_specified', company_cognito_id: 'not_specified',
|
582
|
+
# company_name: 'not_specified', ghost_user_cognito_id: 'not_specified' }
|
583
|
+
|
584
|
+
current_log.update_user({ email: 'new_email' } })
|
585
|
+
current_log.user
|
586
|
+
# { cognito_id: 'not_specified', email: 'new_email', company_cognito_id: 'not_specified',
|
587
|
+
# company_name: 'not_specified', ghost_user_cognito_id: 'not_specified' }
|
539
588
|
```
|
540
589
|
|
541
590
|
---
|
@@ -550,56 +599,56 @@ current_log.desc
|
|
550
599
|
|
551
600
|
---
|
552
601
|
|
553
|
-
####
|
554
|
-
|
602
|
+
#### update_type
|
603
|
+
updates the type attribute currently set in the log's description
|
555
604
|
|
556
605
|
```ruby
|
557
606
|
current_log.desc
|
558
607
|
# { type: 'not_specified', service: 'not_specified', action: 'not_specified' }
|
559
608
|
|
560
|
-
current_log.
|
609
|
+
current_log.update_type('transaction')
|
561
610
|
current_log.desc
|
562
611
|
# { type: 'transaction', service: 'not_specified', action: 'not_specified' }
|
563
612
|
```
|
564
613
|
|
565
614
|
---
|
566
615
|
|
567
|
-
####
|
568
|
-
|
616
|
+
#### update_service
|
617
|
+
updates the service attribute currently set in the log's description
|
569
618
|
|
570
619
|
```ruby
|
571
620
|
current_log.desc
|
572
621
|
# { type: 'not_specified', service: 'not_specified', action: 'not_specified' }
|
573
622
|
|
574
|
-
current_log.
|
623
|
+
current_log.update_service('videos')
|
575
624
|
current_log.desc
|
576
625
|
# { type: 'not_specified', service: 'videos', action: 'not_specified' }
|
577
626
|
```
|
578
627
|
|
579
628
|
---
|
580
629
|
|
581
|
-
####
|
582
|
-
|
630
|
+
#### update_action
|
631
|
+
updates the action attribute currently set in the log's description
|
583
632
|
|
584
633
|
```ruby
|
585
634
|
current_log.desc
|
586
635
|
# { type: 'not_specified', service: 'not_specified', action: 'not_specified' }
|
587
636
|
|
588
|
-
current_log.
|
637
|
+
current_log.update_action('delete')
|
589
638
|
current_log.desc
|
590
639
|
# { type: 'not_specified', service: 'not_specified', action: 'delete' }
|
591
640
|
```
|
592
641
|
|
593
642
|
---
|
594
643
|
|
595
|
-
####
|
596
|
-
|
644
|
+
#### update_desc
|
645
|
+
updates the currently set log's description
|
597
646
|
|
598
647
|
```ruby
|
599
648
|
current_log.desc
|
600
649
|
# { type: 'not_specified', service: 'not_specified', action: 'not_specified' }
|
601
650
|
|
602
|
-
current_log.
|
651
|
+
current_log.update_desc({ type: 'uncaught_error', action: 'create' })
|
603
652
|
current_log.desc
|
604
653
|
# { type: 'uncaught_error', service: 'not_specified', action: 'create' }
|
605
654
|
```
|
@@ -611,22 +660,32 @@ returns the currently set main_content
|
|
611
660
|
|
612
661
|
```ruby
|
613
662
|
current_log.main_content
|
614
|
-
# { modified_records: {} }
|
663
|
+
# { modified_records: {}, errors: [] }
|
615
664
|
|
616
665
|
```
|
617
666
|
|
618
667
|
---
|
619
668
|
|
620
|
-
####
|
621
|
-
|
669
|
+
#### update_main_content
|
670
|
+
updates the currently set main_content
|
622
671
|
|
623
672
|
```ruby
|
624
673
|
current_log.main_content
|
625
|
-
# { modified_records: {} }
|
674
|
+
# { modified_records: {}, errors: [] }
|
626
675
|
|
627
|
-
|
676
|
+
new_content = {
|
677
|
+
modified_records: {
|
678
|
+
'videos' => [{ title: 'Lateralus', id: 42 }]
|
679
|
+
}
|
680
|
+
}
|
681
|
+
current_log.update_main_content(new_content)
|
628
682
|
current_log.main_content
|
629
|
-
# {
|
683
|
+
# {
|
684
|
+
# modified_records: {
|
685
|
+
# 'videos' => [{ title: 'Lateralus', id: 42 }]
|
686
|
+
# },
|
687
|
+
# errors: []
|
688
|
+
# }
|
630
689
|
```
|
631
690
|
|
632
691
|
---
|
@@ -636,11 +695,11 @@ merges hash with currently set main_content
|
|
636
695
|
|
637
696
|
```ruby
|
638
697
|
current_log.main_content
|
639
|
-
# { modified_records: {} }
|
698
|
+
# { modified_records: {}, errors: ['err1', 'err2'] }
|
640
699
|
|
641
|
-
current_log.add_to_main_content(
|
700
|
+
current_log.add_to_main_content(errors: ['err50'])
|
642
701
|
current_log.main_content
|
643
|
-
# { modified_records: {},
|
702
|
+
# { modified_records: {}, errors: ['err1', 'err2', 'err50'] }
|
644
703
|
```
|
645
704
|
|
646
705
|
---
|
@@ -660,7 +719,7 @@ overwrites the modified_records stored in the main_content
|
|
660
719
|
|
661
720
|
```ruby
|
662
721
|
current_log.modified_records
|
663
|
-
# {}
|
722
|
+
# { tracks: [{ id: 87, title: 'Hips Dont Lie' }] }
|
664
723
|
|
665
724
|
current_log.overwrite_modified_records({ tracks: [{ id: 88, title: 'Lateralus' }] })
|
666
725
|
current_log.modified_records
|
@@ -670,18 +729,19 @@ current_log.modified_records
|
|
670
729
|
---
|
671
730
|
|
672
731
|
#### add_modified_record
|
673
|
-
merges hash with currently set modified_records
|
732
|
+
merges hash with currently set modified_records. Notice it receives two arguments: the `tablename` and the `record` itself;
|
674
733
|
|
675
734
|
```ruby
|
676
735
|
current_log.modified_records
|
677
736
|
# { tracks: [{ id: 88, title: 'Lateralus' }] }
|
678
737
|
|
679
|
-
current_log.
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
738
|
+
current_log.add_modified_records('tracks', { id: 89, title: "Hips Don't lie" })
|
739
|
+
current_log.modified_records
|
740
|
+
# {
|
741
|
+
# tracks: [{ id: 88, title: 'Lateralus' }, { id: 89, title: "Hips Don't lie" }],
|
742
|
+
# }
|
743
|
+
|
744
|
+
current_log.add_modified_records('videos', { id: 42, title: 'Life Of Brian' })
|
685
745
|
current_log.modified_records
|
686
746
|
# {
|
687
747
|
# tracks: [{ id: 88, title: 'Lateralus' }, { id: 89, title: "Hips Don't lie" }],
|
@@ -691,15 +751,51 @@ current_log.modified_records
|
|
691
751
|
|
692
752
|
---
|
693
753
|
|
754
|
+
#### errors
|
755
|
+
returns the errors stored in the main_content
|
756
|
+
|
757
|
+
```ruby
|
758
|
+
current_log.errors
|
759
|
+
# []
|
760
|
+
```
|
761
|
+
|
762
|
+
---
|
763
|
+
|
764
|
+
#### overwrite_errors
|
765
|
+
overwrites the errors stored in the main_content
|
766
|
+
|
767
|
+
```ruby
|
768
|
+
current_log.errors
|
769
|
+
# ['err1', 'err2', 'err3']
|
770
|
+
|
771
|
+
current_log.overwrite_errors(['err500'])
|
772
|
+
current_log.errors
|
773
|
+
# ['err500']
|
774
|
+
```
|
775
|
+
|
776
|
+
---
|
777
|
+
|
778
|
+
#### add_error
|
779
|
+
merges hash with currently set errors
|
780
|
+
|
781
|
+
```ruby
|
782
|
+
current_log.errors
|
783
|
+
# ['err1', 'err2', 'err3']
|
784
|
+
|
785
|
+
current_log.add_error('err400')
|
786
|
+
current_log.errors
|
787
|
+
# ['err1', 'err2', 'err3', 'err400']}
|
788
|
+
```
|
789
|
+
|
694
790
|
#### clear_log_info
|
695
|
-
sets agent, desc, and main_content to their default values.
|
791
|
+
sets agent, desc, and main_content to their default values.
|
696
792
|
|
697
793
|
|
698
|
-
##
|
699
|
-
Following
|
794
|
+
## Snippets for Quicker Logging
|
795
|
+
Following is a series of snippets for quickly setting up some basic logging functionality.
|
796
|
+
**Please notice that the snippets in this section use the [paper_trail gem](https://github.com/paper-trail-gem/paper_trail/blob/v9.2.0/README.md#1c-basic-usage) for improving logs. Its use is optional, but recommended.**
|
700
797
|
|
701
798
|
### Papertrail Optional Use
|
702
|
-
**Please notice that the snippets in this section use the [paper_trail gem](https://github.com/paper-trail-gem/paper_trail/blob/v9.2.0/README.md#1c-basic-usage) for improving logs.**
|
703
799
|
|
704
800
|
> ChiliLogger works just fine without paper_trail. If you don't want to use paper_trail or if your application doesn't use ActiveRecords, you can skip the following code.
|
705
801
|
>
|
@@ -721,46 +817,286 @@ class ApplicationRecord < ActiveRecord::Base
|
|
721
817
|
has_paper_trail # add this line!
|
722
818
|
end
|
723
819
|
```
|
820
|
+
If your controllers have a current_user, it usually won't be accessible in the models. When implementing logs, though, it is a behaviour you might be interested in, so you can log changes to the DB knowing who was the user responsible for that change. PaperTrail has a feature called `whodunnit`, which is [used precisely for this purpose](https://github.com/paper-trail-gem/paper_trail/blob/v10.3.1/README.md#setting-whodunnit-with-a-controller-callback).
|
821
|
+
```ruby
|
822
|
+
# controllers/application_controller.rb
|
823
|
+
class ApplicationController < ActionController::Base
|
824
|
+
# sets papertrail Whodunit based on user defined in user_for_paper_trail
|
825
|
+
before_action :set_paper_trail_whodunnit
|
826
|
+
|
827
|
+
# customizes method implemented by PaperTrail and that sets PaperTrail.request.whodunnit
|
828
|
+
# PaperTrail.request.whodunnit will be available in all parts of application while a request is being processed
|
829
|
+
def user_for_paper_trail
|
830
|
+
current_user
|
831
|
+
end
|
832
|
+
end
|
833
|
+
```
|
724
834
|
|
835
|
+
### Logging Transactions in HTTP Requests
|
836
|
+
Transactions happen in two main layers of an application: the controllers handling the request and the models persisting data. If your application has an ApplicationController from which all other controllers inherit, and also an ApplicationRecord from which all models inherit, we can quickly set standardized logs for transactions and errors.
|
725
837
|
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
838
|
+
#### Controllers Logging Logic
|
839
|
+
Just add the following code to your ApplicationController:
|
840
|
+
```ruby
|
841
|
+
# controllers/application_controller.rb
|
842
|
+
class ApplicationController < ActionController::Base
|
843
|
+
before_action :start_new_log
|
844
|
+
rescue_from StandardError, with: :publish_error_log
|
845
|
+
after_action :publish_log
|
846
|
+
|
847
|
+
def start_new_log
|
848
|
+
table_name = self.class.name.split('::').last.gsub('Controller', '').underscore
|
849
|
+
# action_name is available in Rails apps, Sinatra apps may need some other solution
|
850
|
+
log_action = action_name == 'destroy' ? 'delete' : action_name
|
851
|
+
|
852
|
+
desc ||= log_description('transaction', table_name, log_action)
|
853
|
+
user = log_user
|
854
|
+
|
855
|
+
ChiliLogger.instance.start_new_log(desc: desc, user: user)
|
856
|
+
end
|
857
|
+
|
858
|
+
# publishes transaction log with the main infos about the request
|
859
|
+
def publish_log
|
860
|
+
# only publish log if current log had modified_records added to it, so we don't clutter logs with index requests
|
861
|
+
return if ChiliLogger.instance.current_log.modified_records.empty?
|
862
|
+
|
863
|
+
ChiliLogger.instance.current_log.publish
|
864
|
+
end
|
865
|
+
|
866
|
+
# if unexpected errors happen, will change log type and publish it for debugging/audit
|
867
|
+
def publish_error_log(error)
|
868
|
+
error = [error.inspect, Rails.backtrace_cleaner.clean(error.backtrace)]
|
869
|
+
current_log = ChiliLogger.instance.current_log
|
870
|
+
|
871
|
+
current_log.add_error(error)
|
872
|
+
current_log.update_type('uncaught_error')
|
873
|
+
current_log.publish
|
874
|
+
|
875
|
+
raise error
|
876
|
+
end
|
877
|
+
|
878
|
+
private
|
879
|
+
|
880
|
+
def log_description(type, service, action)
|
881
|
+
{ type: type, service: service, action: action }
|
882
|
+
end
|
883
|
+
|
884
|
+
# customize according to your app's schema
|
885
|
+
def log_user
|
886
|
+
return {} unless current_user
|
887
|
+
|
888
|
+
# use .where instead of .find, because .find raises error if no record is found
|
889
|
+
multi_user_record = MultiUser::User.where(external_id: current_user&.cognito_id).first
|
890
|
+
log_user = {
|
891
|
+
email: current_user&.email,
|
892
|
+
cognito_id: multi_user_record&.id,
|
893
|
+
company_name: current_user&.company&.name,
|
894
|
+
company_cognito_id: multi_user_record&.organization&.id
|
895
|
+
}
|
896
|
+
log_user.merge!(ghost_user_cognito_id: admin_ghost_user&.cognito_id) # if app has admins that can log as other users
|
897
|
+
end
|
898
|
+
end
|
899
|
+
```
|
756
900
|
|
901
|
+
Notice that `start_new_log` will set the log's service and action based on the controller name and the method being called. So if VideosController has its create method called, it would generate a log with service="videos" and action="create". Individual controllers and methods can be customized by using the [current_log accessors](###customizing-a-started-log).
|
902
|
+
|
903
|
+
For example, suppose we would like the GalleryFilesController to generate custom logs with service='gallery' and we would like GalleryFilesController#find_files to define action='filter'. We could do the following:
|
904
|
+
```ruby
|
905
|
+
# app/controllers/gallery_files.rb
|
906
|
+
class GalleryFilesController < ApplicationController
|
907
|
+
before_action :overwrite_log_service
|
908
|
+
|
909
|
+
def find_files
|
910
|
+
ChiliLogger.instance.current_log.update_action('filter')
|
911
|
+
# method's usual code...
|
912
|
+
end
|
913
|
+
|
914
|
+
private
|
915
|
+
|
916
|
+
# customizes logs created by ApplicationController's start_new_log method
|
917
|
+
def overwrite_log_service
|
918
|
+
ChiliLogger.instance.current_log.update_service('gallery')
|
919
|
+
end
|
920
|
+
end
|
921
|
+
```
|
922
|
+
|
923
|
+
#### Models Logging Logic
|
924
|
+
The code above implements automatic logs for requests made to controllers. We can further improve the logs being created by adding the DB records that were modified during the request:
|
925
|
+
```ruby
|
926
|
+
class ApplicationRecord < ActiveRecord::Base
|
927
|
+
self.abstract_class = true
|
928
|
+
|
929
|
+
after_create -> { add_modified_record_to_log('create') }, on: :create
|
930
|
+
after_update -> { add_modified_record_to_log('update') }, on: :update
|
931
|
+
before_destroy -> { add_modified_record_to_log('destroy') }, on: :destroy
|
932
|
+
|
933
|
+
has_paper_trail # if you are using paper_trail
|
934
|
+
|
935
|
+
# enriches logs by automatically adding modified_records to them
|
936
|
+
def add_modified_record_to_log(action_verb, modified_record = self)
|
937
|
+
# only adds to log if record was created, changed or destroyed
|
938
|
+
return if !new_record? && !saved_changes? && action_verb != 'destroy'
|
939
|
+
|
940
|
+
current_log = ChiliLogger.instance.current_log
|
941
|
+
current_log.update_type('transaction_error') unless modified_record.errors.messages.empty?
|
942
|
+
current_log.add_modified_record(self.class.table_name, modified_record.to_denormalized_hash)
|
943
|
+
end
|
944
|
+
|
945
|
+
# ChiliLogger requires modified_records to be hashes.
|
946
|
+
# This method converts ActiveRecords instances to hashes and adds some extra useful data
|
947
|
+
def to_denormalized_hash(record_hash = as_json)
|
948
|
+
record_hash[:last_changes] = versions.last.changeset if versions.last #if you are using paper_trail
|
949
|
+
record_hash[:errors] = errors
|
950
|
+
|
951
|
+
record_hash
|
952
|
+
end
|
953
|
+
end
|
954
|
+
```
|
955
|
+
|
956
|
+
The code above will add all modified records to the transaction logs. We implement a `to_denormalized_hash` method, which converts the ActiveRecord isntance to a hash, as ChiliLogger requires. This method can be customized in individual models, to generate logs with even more information (for instance, denormalizing the main ActiveRecords relations):
|
957
|
+
```ruby
|
958
|
+
# app/models/banner.rb
|
959
|
+
class Banner < ApplicationRecord
|
960
|
+
# customizes inherited ApplicationRecord's method, denormalizing the record's main relations
|
961
|
+
def to_denormalized_hash(record_hash = as_json)
|
962
|
+
relations = Banner.includes(:campaign)
|
963
|
+
.includes(template: %i[category template_collection])
|
964
|
+
.find(id)
|
965
|
+
|
966
|
+
record_hash[:campaign] = relations.campaign.as_json
|
967
|
+
record_hash[:template] = relations.template.as_json
|
968
|
+
record_hash[:template][:category] = relations.template.category.as_json
|
969
|
+
record_hash[:template][:template_collection] = relations.template.template_collection.as_json
|
970
|
+
|
971
|
+
super(record_hash) # calls ActiveRecords's to_denormalized_hash
|
972
|
+
end
|
973
|
+
end
|
974
|
+
```
|
975
|
+
|
976
|
+
### Logging Rake Tasks
|
977
|
+
When logging transactions made in tasks, we have three main concerns: logging uncaught errors in the task, logging transactions performed by the task and log whether the task is up and running, for monitoring.
|
978
|
+
|
979
|
+
#### Logging Uncaught Task Errors
|
980
|
+
For this, we must create a standardized way of handling task errors. The best wayto do it is with a monkey-patch to rake, by creating the following file:
|
981
|
+
```ruby
|
982
|
+
# config/initializers/task.rb
|
983
|
+
require 'rake/task'
|
984
|
+
|
985
|
+
module Rake
|
986
|
+
class Task
|
987
|
+
alias :original_execute :execute
|
988
|
+
|
989
|
+
# customizes the execute method of Rake::Task
|
990
|
+
def execute(args=nil)
|
991
|
+
begin
|
992
|
+
# start storing default log infos for rake tasks before they even begin
|
993
|
+
log_desc = { log_type: 'error', service: 'automated_task', action: 'uncaught_error' }
|
994
|
+
log_user = { email: 'automated_task', cognito_id: 'automated_task' }
|
995
|
+
ChiliLogger.instance.start_new_log(desc: log_desc, user: log_user)
|
996
|
+
|
997
|
+
original_execute(args)
|
998
|
+
|
999
|
+
rescue StandardError => error
|
1000
|
+
current_log = ChiliLogger.instance.current_log
|
1001
|
+
|
1002
|
+
current_task = Rake.application.top_level_tasks.first
|
1003
|
+
current_log.update_service(current_task.split(':').first)
|
1004
|
+
current_log.update_action(current_task.split(':').last)
|
1005
|
+
|
1006
|
+
current_log.add_error(error.inspect)
|
1007
|
+
current_log.update_type('uncaught_error')
|
1008
|
+
current_log.publish
|
1009
|
+
|
1010
|
+
raise error
|
1011
|
+
end
|
1012
|
+
end
|
1013
|
+
end
|
1014
|
+
end
|
1015
|
+
```
|
1016
|
+
|
1017
|
+
#### Logging Transactions in Tasks
|
1018
|
+
Unfortunately, for the time being, we still haven't found a practical way to log all Task transactions with minimal setup. The way most of our tasks are implemented - as infinite loops - requires us to add logging logic to each and every task, by doing so:
|
1019
|
+
```ruby
|
1020
|
+
# lib/tasks/example_task.rake
|
1021
|
+
namespace :excel do
|
1022
|
+
task validation: :environment do
|
1023
|
+
loop do
|
1024
|
+
# start storing infos for validation log
|
1025
|
+
transaction_desc = { type: 'transaction', service: 'excel', action: 'validation' }
|
1026
|
+
log_user = { email: 'automated_task', cognito_id: 'automated_task'
|
1027
|
+
current_log = ChiliLogger.instance.start_new_log(desc: log_desc, user: log_user)
|
1028
|
+
|
1029
|
+
usual task code...
|
1030
|
+
|
1031
|
+
# only publish log if current log had modified_records added to it - so we don't clutter DB with meaningless logs
|
1032
|
+
current_log.publish unless current_log.modified_records.empty?
|
1033
|
+
|
1034
|
+
sleep 5
|
1035
|
+
end
|
1036
|
+
end
|
1037
|
+
```
|
1038
|
+
Until we come up with a better solution, this will have to be done to each and every task of interest. Notice that the snippet above assumes you have [edited the models to enrich logs with modified_records](####models-logging-logic).
|
1039
|
+
|
1040
|
+
#### Logging Heartbeats in Tasks
|
1041
|
+
Besides monitoring transactions and unexpected errors, it is also important to monitor whether all main parts of an application are up and running. For servers, we do that by pinging specific endpoints to see if the server is up and responding. Tasks pose a different problem, since they have no endpoint we can ping. Besides, a task maybe up and with a 'running' status, but being stuck all the same and not processing new data. For that reason, we use ChiliLogger to monitor tasks' healht.
|
1042
|
+
|
1043
|
+
Unfortunately, due to the way most of our tasks are implemented - as infinite loops - we must add logging logic to each and every task, by doing so:
|
1044
|
+
```ruby
|
1045
|
+
# lib/tasks/example_task.rake
|
1046
|
+
namespace :excel do
|
1047
|
+
task validation: :environment do
|
1048
|
+
loop do
|
1049
|
+
heartbeat_desc = { type: 'monitoring', service: 'excel', action: 'validation' }
|
1050
|
+
log_user = { email: 'automated_task', cognito_id: 'automated_task'
|
1051
|
+
ChiliLogger.instance.publish_instant_log(desc: heartbeat_desc, user: log_user)
|
1052
|
+
|
1053
|
+
usual task code...
|
1054
|
+
|
1055
|
+
sleep 5
|
1056
|
+
end
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
```
|
1060
|
+
|
757
1061
|
## Coverage
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
1062
|
+
ChiliLogger keeps a coverage report, showing what kinds of logs are being created. This can be usefull to see whether all important points of an application are being satisfactorily monitored and also to have an overview of how these logs description tags are looking like. This coverage report can be found in `app_root/log/chili-logger-coverage.yml`. It is an YAML file with 4 dimensions:
|
1063
|
+
- first dimension: type;
|
1064
|
+
- second dimension: service;
|
1065
|
+
- third dimension: action;
|
1066
|
+
- fourth dimension: an array with the backtrace of the last created log to a given type, service and action combination;
|
1067
|
+
|
1068
|
+
```yaml
|
1069
|
+
transaction: #log's type
|
1070
|
+
videos: # log's service
|
1071
|
+
create: # log's action
|
1072
|
+
- "backtrace_path_1" # backtrace for transaction.videos.create
|
1073
|
+
- "backtrace_path_2"
|
1074
|
+
- "backtrace_path_3"
|
1075
|
+
update: # log's action
|
1076
|
+
- "backtrace_path_1" # backtrace for transaction.videos.update
|
1077
|
+
- "backtrace_path_2"
|
1078
|
+
- "backtrace_path_3"
|
1079
|
+
banners:
|
1080
|
+
create: # log's action
|
1081
|
+
- "backtrace_path_1" # backtrace for transaction.banners.create
|
1082
|
+
- "backtrace_path_2"
|
1083
|
+
- "backtrace_path_3"
|
1084
|
+
accept: # log's action
|
1085
|
+
- "backtrace_path_1" # backtrace for transaction.banners.accept
|
1086
|
+
- "backtrace_path_2"
|
1087
|
+
- "backtrace_path_3"
|
1088
|
+
|
1089
|
+
uncaught_error: #log's type
|
1090
|
+
gallery: # log's service
|
1091
|
+
index: # log's action
|
1092
|
+
- "backtrace_path_1" # backtrace for uncaught_error.gallery_index
|
1093
|
+
- "backtrace_path_2"
|
1094
|
+
- "backtrace_path_3"
|
1095
|
+
|
1096
|
+
monitoring: #log's type
|
1097
|
+
campaigns: # log's service
|
1098
|
+
validate_sheet: # log's action
|
1099
|
+
- "backtrace_path_1" # backtrace for monitoring.campaigns.validate_sheet
|
1100
|
+
- "backtrace_path_2"
|
1101
|
+
- "backtrace_path_3"
|
1102
|
+
```
|
data/chili_logger.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.homepage = 'https://gitlab.com/chiligumdev/chili_logger'
|
12
12
|
spec.license = 'MIT'
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
14
|
-
spec.add_dependency 'aws-sdk', '~>
|
14
|
+
spec.add_dependency 'aws-sdk-sqs', '~> 1.30.0'
|
15
15
|
spec.add_dependency 'bunny'
|
16
16
|
spec.add_dependency 'httparty'
|
17
17
|
|
@@ -46,13 +46,8 @@ class ChiliLogger
|
|
46
46
|
# if no routing_key was provided when configuring RabbitBroker, than use the one received by the method here
|
47
47
|
# temporary solution so we can force configure ChiliLogger to use a specific routing_key
|
48
48
|
key = @routing_key_overwriter || routing_key
|
49
|
-
puts key
|
50
|
-
puts key
|
51
|
-
puts key
|
52
|
-
puts key
|
53
|
-
puts key
|
54
|
-
puts key
|
55
49
|
@exchange.publish(message.to_json, routing_key: key)
|
50
|
+
puts "sent message to #{@exchange_name}, with routing_key = '#{key}'"
|
56
51
|
|
57
52
|
rescue StandardError => e
|
58
53
|
@logging_error_handler.handle_error(e, message)
|
@@ -69,16 +64,11 @@ class ChiliLogger
|
|
69
64
|
end
|
70
65
|
|
71
66
|
def connection_config
|
72
|
-
# shouldn't try to recover connection,
|
73
|
-
# it may cause app in production to collapse if reconnection doesn't work or takes too many attempts!!!
|
74
|
-
recovery_attempts = 0
|
75
|
-
|
76
67
|
{
|
77
68
|
user: @user,
|
78
69
|
password: @password,
|
79
70
|
host: @ip,
|
80
|
-
port: @port
|
81
|
-
recovery_attempts: recovery_attempts
|
71
|
+
port: @port
|
82
72
|
}
|
83
73
|
end
|
84
74
|
|
data/lib/brokers/sqs_broker.rb
CHANGED
data/lib/chili_logger/version.rb
CHANGED
data/lib/current_log_accessor.rb
CHANGED
@@ -3,7 +3,6 @@ require 'helpers/values/default'
|
|
3
3
|
require 'helpers/values/type_uniformizer/desc'
|
4
4
|
require 'helpers/values/type_uniformizer/main_content'
|
5
5
|
require 'helpers/values/type_uniformizer/user'
|
6
|
-
require 'byebug'
|
7
6
|
|
8
7
|
# class for centralizing Creative's logging logic
|
9
8
|
class ChiliLogger
|
@@ -0,0 +1,99 @@
|
|
1
|
+
---
|
2
|
+
test:
|
3
|
+
console:
|
4
|
+
publish_test:
|
5
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/chili_logger-0.0.8/lib/chili_logger.rb:61:in
|
6
|
+
`publish_instant_log'"
|
7
|
+
- "(pry):28:in `__pry__'"
|
8
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:290:in
|
9
|
+
`eval'"
|
10
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:290:in
|
11
|
+
`evaluate_ruby'"
|
12
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:659:in
|
13
|
+
`handle_line'"
|
14
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:261:in
|
15
|
+
`block (2 levels) in eval'"
|
16
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:260:in
|
17
|
+
`catch'"
|
18
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:260:in
|
19
|
+
`block in eval'"
|
20
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:259:in
|
21
|
+
`catch'"
|
22
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:259:in
|
23
|
+
`eval'"
|
24
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:77:in `block
|
25
|
+
in repl'"
|
26
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:67:in `loop'"
|
27
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:67:in `repl'"
|
28
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:38:in `block
|
29
|
+
in start'"
|
30
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/input_lock.rb:61:in
|
31
|
+
`__with_ownership'"
|
32
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/input_lock.rb:78:in
|
33
|
+
`with_ownership'"
|
34
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:38:in `start'"
|
35
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:15:in `start'"
|
36
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_class.rb:191:in
|
37
|
+
`start'"
|
38
|
+
- "/home/lucas/.irbrc:8:in `<top (required)>'"
|
39
|
+
- "/usr/share/rvm/scripts/irbrc.rb:40:in `load'"
|
40
|
+
- "/usr/share/rvm/scripts/irbrc.rb:40:in `<top (required)>'"
|
41
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in
|
42
|
+
`require'"
|
43
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in
|
44
|
+
`require'"
|
45
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/.irbrc:11:in `<top (required)>'"
|
46
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/init.rb:231:in `load'"
|
47
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/init.rb:231:in `run_config'"
|
48
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/init.rb:20:in `setup'"
|
49
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb.rb:378:in `start'"
|
50
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/bin/irb:11:in `<main>'"
|
51
|
+
transaction:
|
52
|
+
console:
|
53
|
+
publish_test:
|
54
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/chili_logger-0.0.12/lib/chili_logger.rb:61:in
|
55
|
+
`publish_instant_log'"
|
56
|
+
- "(pry):50:in `__pry__'"
|
57
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:290:in
|
58
|
+
`eval'"
|
59
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:290:in
|
60
|
+
`evaluate_ruby'"
|
61
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:659:in
|
62
|
+
`handle_line'"
|
63
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:261:in
|
64
|
+
`block (2 levels) in eval'"
|
65
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:260:in
|
66
|
+
`catch'"
|
67
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:260:in
|
68
|
+
`block in eval'"
|
69
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:259:in
|
70
|
+
`catch'"
|
71
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_instance.rb:259:in
|
72
|
+
`eval'"
|
73
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:77:in `block
|
74
|
+
in repl'"
|
75
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:67:in `loop'"
|
76
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:67:in `repl'"
|
77
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:38:in `block
|
78
|
+
in start'"
|
79
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/input_lock.rb:61:in
|
80
|
+
`__with_ownership'"
|
81
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/input_lock.rb:78:in
|
82
|
+
`with_ownership'"
|
83
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:38:in `start'"
|
84
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/repl.rb:15:in `start'"
|
85
|
+
- "/home/lucas/.rvm/gems/ruby-2.3.3/gems/pry-0.13.1/lib/pry/pry_class.rb:191:in
|
86
|
+
`start'"
|
87
|
+
- "/home/lucas/.irbrc:8:in `<top (required)>'"
|
88
|
+
- "/usr/share/rvm/scripts/irbrc.rb:40:in `load'"
|
89
|
+
- "/usr/share/rvm/scripts/irbrc.rb:40:in `<top (required)>'"
|
90
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in
|
91
|
+
`require'"
|
92
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in
|
93
|
+
`require'"
|
94
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/.irbrc:11:in `<top (required)>'"
|
95
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/init.rb:231:in `load'"
|
96
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/init.rb:231:in `run_config'"
|
97
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb/init.rb:20:in `setup'"
|
98
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/irb.rb:378:in `start'"
|
99
|
+
- "/usr/share/rvm/rubies/ruby-2.3.3/bin/irb:11:in `<main>'"
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chili_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lucas sandeville
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: aws-sdk
|
14
|
+
name: aws-sdk-sqs
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 2.9.0
|
20
17
|
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 1.30.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.9.0
|
30
24
|
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 1.30.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: bunny
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,8 +75,6 @@ files:
|
|
81
75
|
- assets/images/rabbit-topic-explanation.webp
|
82
76
|
- bin/console
|
83
77
|
- bin/setup
|
84
|
-
- chili_logger-0.0.6.gem
|
85
|
-
- chili_logger-0.0.7.gem
|
86
78
|
- chili_logger.gemspec
|
87
79
|
- lib/brokers/rabbit_broker.rb
|
88
80
|
- lib/brokers/sqs_broker.rb
|
@@ -100,6 +92,7 @@ files:
|
|
100
92
|
- lib/helpers/values/type_uniformizer/user.rb
|
101
93
|
- lib/message_writer/aws_ops_metadata.rb
|
102
94
|
- lib/message_writer/message_writer.rb
|
95
|
+
- log/chili-logger-coverage.yml
|
103
96
|
homepage: https://gitlab.com/chiligumdev/chili_logger
|
104
97
|
licenses:
|
105
98
|
- MIT
|
data/chili_logger-0.0.6.gem
DELETED
Binary file
|
data/chili_logger-0.0.7.gem
DELETED
Binary file
|