Skip to content

Commit 2f55baf

Browse files
updated readme
1 parent 433249c commit 2f55baf

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

readme.md

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Logger for Aws Cloud Watch
22

3+
### Breaking Change for version 1.0
4+
5+
When this package started it started as a listener for log event and would only work with another driver.
6+
This package would listen to log events and just log extra to cloud watch but after `1.0` it works as a custom driver.
7+
So, you MUST add a `LOG_CHANNEL` for logging in your config for this to work.
8+
39
### Installation
410

511
`composer require pagevamp/laravel-cloudwatch-logs`
@@ -28,34 +34,16 @@ Config for logging is defined at `config/logging.php`. Add `cloudwatch` to the `
2834
'retention' => env('CLOUDWATCH_LOG_RETENTION_DAYS', 14),
2935
'group_name' => env('CLOUDWATCH_LOG_GROUP_NAME', 'laravel_app'),
3036
'version' => env('CLOUDWATCH_LOG_VERSION', 'latest'),
31-
'formatter' => \Monolog\Formatter\JsonFormatter::class,
32-
'disabled' => env('DISABLE_CLOUDWATCH_LOG', false),
37+
'formatter' => \Monolog\Formatter\JsonFormatter::class,
38+
'via' => \Pagevamp\Logger::class,
3339
],
3440
]
3541
```
3642

37-
Add correct values to keys in your `.env` file. And it should work.
43+
And set the log channel in your environment variable to `LOG_CHANNEL` to `cloudwatch`.
3844

3945
If the role of your AWS EC2 instance has access to Cloudwatch logs, `CLOUDWATCH_LOG_KEY` and `CLOUDWATCH_LOG_SECRET` need not be defined in your `.env` file.
4046

41-
### Add To Project
42-
43-
#### Laravel 5.5 or Higher
44-
45-
This package uses laravel's [Package discovery](https://laravel.com/docs/5.6/packages#package-discovery). To disable this package by default you can add `DISABLE_CLOUDWATCH_LOG=true` to you local `.env` file and this package will be disabled.
46-
47-
#### Laravel 5.4 or Lower
48-
49-
Add to the `providers` array in `config/app.php`:
50-
51-
```
52-
Pagevamp\Providers\CloudWatchServiceProvider::class
53-
```
54-
55-
### Concept
56-
57-
This package relies on laravel's listener for log events. This package DOES NOT replace the default logging, instead adds additional log to AWS CLoud Watch. Hence you do not have to change the default log driver to make this work.
58-
5947
### Contribution
6048

6149
I have added a `pre-commit` hook to run `php-cs-fixer` whenever you make a commit. To enable this run `sh hooks.sh`.

src/Logger.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function __invoke(array $config)
4646
* in key cloudwatch.
4747
*
4848
* 'cloudwatch' => [
49+
* 'driver' => 'custom',
4950
* 'name' => env('CLOUDWATCH_LOG_NAME', ''),
5051
* 'region' => env('CLOUDWATCH_LOG_REGION', ''),
5152
* 'credentials' => [
@@ -56,6 +57,7 @@ public function __invoke(array $config)
5657
* 'retention' => env('CLOUDWATCH_LOG_RETENTION_DAYS', 14),
5758
* 'group_name' => env('CLOUDWATCH_LOG_GROUP_NAME', 'laravel_app'),
5859
* 'version' => env('CLOUDWATCH_LOG_VERSION', 'latest'),
60+
* 'via' => \Pagevamp\Logger::class,
5961
* ]
6062
*
6163
* @return array

0 commit comments

Comments
 (0)