File tree Expand file tree Collapse file tree 1 file changed +32
-4
lines changed Expand file tree Collapse file tree 1 file changed +32
-4
lines changed Original file line number Diff line number Diff line change 66
77A library with logging enhancement. Including:
88
9- - ` LogWithClassPath ` trait
10- - It adds convinient methods for logging to add class path into context.
9+ - ` LoggerFacade ` facade
10+ - It extends default Laravel ` Log ` facade with logging adding class path and tracking id into context.
11+ - ` LogWithClassPath ` trait (* deprecated* )
12+ - It adds convinient methods for logging to add class path and tracking id into context.
1113- ` LogglyHandler ` class
1214 - It extends monolog's LogglyHandler with tags support
1315
@@ -19,7 +21,32 @@ composer require onramplab/laravel-log-enhancement
1921
2022## Usage
2123
22- ### LogWithClassPath Trait
24+ ### LoggerFacade
25+
26+ Replace the class of ` Log ` alias to ` LoggerFacade ` in ` config/app.php ` as aliases.
27+
28+ ``` php
29+ 'Log' => Onramplab\LaravelLogEnhancement\Facades\LoggerFacade::class,
30+ ```
31+
32+ The log json will look like this:
33+
34+ ``` json
35+ {
36+ "message" : " Test" ,
37+ "context" : {
38+ "class_path" : " App\\ Fake" ,
39+ "tracking_id" : " 652c3456-1a17-42b8-9fa7-9bee65e655eb"
40+ },
41+ "level" : 200 ,
42+ "level_name" : " INFO" ,
43+ "channel" : " local" ,
44+ "extra" : {},
45+ "timestamp" : " 2021-01-04T22:47:56.598608-0800"
46+ }
47+ ```
48+
49+ ### LogWithClassPath Trait (* deprecated* )
2350
2451Use ` LogWithClassPath ` trait to let it automatically put class path into log context. You can refer to following code example.
2552
@@ -44,7 +71,8 @@ The log json will look like this:
4471{
4572 "message" : " Test" ,
4673 "context" : {
47- "class_path" : " App\\ Fake"
74+ "class_path" : " App\\ Fake" ,
75+ "tracking_id" : " 652c3456-1a17-42b8-9fa7-9bee65e655eb"
4876 },
4977 "level" : 200 ,
5078 "level_name" : " INFO" ,
You can’t perform that action at this time.
0 commit comments