|
| 1 | +# Laravel Blink Logger |
| 2 | + |
| 3 | +Comprehensive Logging Tool for Laravel. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +Require this package with composer. It is recommended to only require the package for development. |
| 8 | + |
| 9 | +``` |
| 10 | +$ composer require --dev ucan-lab/laravel-blink-logger |
| 11 | +``` |
| 12 | + |
| 13 | +Debug log output is disabled by default, so please enable it in `.env`. |
| 14 | + |
| 15 | +``` |
| 16 | +LOG_SQL_ENABLED=true |
| 17 | +LOG_REQUEST_ENABLED=true |
| 18 | +LOG_RESPONSE_ENABLED=true |
| 19 | +``` |
| 20 | + |
| 21 | +### Option config file publish |
| 22 | + |
| 23 | +Copy the package config to your local config with the publish command: |
| 24 | + |
| 25 | +``` |
| 26 | +$ php artisan vendor:publish --tag=blink-logger |
| 27 | +``` |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +Watch the log file. |
| 32 | + |
| 33 | +``` |
| 34 | +$ tail -f storage/logs/laravel.log |
| 35 | +``` |
| 36 | + |
| 37 | +Example logs. |
| 38 | + |
| 39 | +``` |
| 40 | +[2024-04-05 16:38:58] local.DEBUG: GET: http://example-app.test/api/foo/bar?baz=qux {"request":{"baz":"qux"},"headers":{"accept-language":["ja,en-US;q=0.9,en;q=0.8"],"accept-encoding":["gzip, deflate"],"accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"],"user-agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"],"upgrade-insecure-requests":["1"],"cache-control":["max-age=0"],"connection":["keep-alive"],"host":["example-app.test"]}} |
| 41 | +[2024-04-05 16:38:58] local.DEBUG: START TRANSACTION |
| 42 | +[2024-04-05 16:38:59] local.DEBUG: 4.01 ms, SQL: insert into `users` (`name`, `email`, `email_verified_at`, `password`, `remember_token`, `updated_at`, `created_at`) values ('Concepcion VonRueden Sr.', '[email protected]', '2024-04-05 16:38:58', 'y$L7Lb.DoH7sO5Zb7RrGtSzelx6Y15gBtetVYlI4z4wB5I83oh6To1i', 'ZD34nR26LH', '2024-04-05 16:38:59', '2024-04-05 16:38:59'); |
| 43 | +[2024-04-05 16:38:59] local.DEBUG: 3.02 ms, SQL: update `users` set `name` = 'change name', `users`.`updated_at` = '2024-04-05 16:38:59' where `id` = 122; |
| 44 | +[2024-04-05 16:38:59] local.DEBUG: 1.61 ms, SQL: delete from `users` where `id` = 122; |
| 45 | +[2024-04-05 16:38:59] local.DEBUG: 2.28 ms, SQL: insert into `users` (`name`, `email`, `email_verified_at`, `password`, `remember_token`, `updated_at`, `created_at`) values ('Delfina Brakus IV', '[email protected]', '2024-04-05 16:38:59', 'y$L7Lb.DoH7sO5Zb7RrGtSzelx6Y15gBtetVYlI4z4wB5I83oh6To1i', 'Qvq73GjdiQ', '2024-04-05 16:38:59', '2024-04-05 16:38:59'); |
| 46 | +[2024-04-05 16:38:59] local.DEBUG: COMMIT |
| 47 | +[2024-04-05 16:38:59] local.DEBUG: 2.15 ms, SQL: select * from `users` where `users`.`id` = 123 limit 1; |
| 48 | +[2024-04-05 16:38:59] local.DEBUG: 200 OK {"body":"{\"data\":\"ok\"}","headers":{"cache-control":["no-cache, private"],"date":["Fri, 05 Apr 2024 16:38:59 GMT"],"content-type":["application/json"],"x-ratelimit-limit":["60"],"x-ratelimit-remaining":["55"],"access-control-allow-origin":["*"]}} |
| 49 | +``` |
0 commit comments