Skip to content

Commit d977567

Browse files
committed
doc: add example for LogglyHandler
1 parent b7b207f commit d977567

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
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
1724
Use `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

0 commit comments

Comments
 (0)