File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 44[ ![ CircleCI] ( https://circleci.com/gh/OnrampLab/next-starter.svg?style=shield )] ( )
55[ ![ Total Downloads] ( https://img.shields.io/packagist/dt/onramplab/laravel-log-enhancement.svg?style=flat-square )] ( https://packagist.org/packages/onramplab/laravel-log-enhancement )
66
7+ A library with logging enhancement. Including:
8+
9+ - ` LogWithClassPath ` trait
10+ - It adds convinient methods for logging to add class path into context.
11+ - ` LogglyHandler ` class
12+ - It extends monolog's LogglyHandler with tags support
713
814## Install
915
@@ -14,6 +20,7 @@ composer require onramplab/laravel-log-enhancement
1420
1521## Usage
1622
23+ ### LogWithClassPath Trait
1724Use ` LogWithClassPath ` trait to let it automatically put class path into log context. You can refer to following code example.
1825
1926``` php
@@ -47,8 +54,36 @@ The log json will look like this:
4754}
4855```
4956
57+ ### LogglyHandler
58+
59+ You can adding following block into ` config/logging.php ` .
60+
61+ ``` php
62+ use Monolog\Formatter\LogglyFormatter;
63+ use Onramplab\LaravelLogEnhancement\Handlers\LogglyHandler;
64+
65+ return [
66+ //...
5067
5168
69+ 'channels' => [
70+ //...
71+
72+ 'loggly' => [
73+ 'driver' => 'monolog',
74+ 'level' => 'info',
75+ 'handler' => LogglyHandler::class,
76+ 'handler_with' => [
77+ 'token' => env('LOGGLY_TOKEN'),
78+ 'tags' => env('LOGGLY_TAGS'),
79+ ],
80+ 'formatter' => LogglyFormatter::class,
81+ ],
82+ ]
83+ ];
84+
85+ ```
86+
5287
5388## Testing
5489
You can’t perform that action at this time.
0 commit comments