Skip to content

Commit 74e626c

Browse files
authored
Make optional logging as JSON (#38)
1 parent 26b34ab commit 74e626c

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [v2.0.0]
8+
### Breaking Changes
9+
- Logs are now written in plain text by default instead of JSON. To enable JSON logs, set `channels.stderr.formatter` to `Monolog\Formatter\JsonFormatter::class` in `config/logging.php`.
10+
711
## [Unreleased]
812
## [v0.3.0] - 2022-11-15
913
### Changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ functions:
146146
OCTANE_PERSIST_DATABASE_SESSIONS: 1
147147
```
148148

149+
### JSON logs
150+
151+
If you want all CloudWatch log entries to be JSON objects (for example because you want to ingest those logs in other systems), you can edit `config/logging.php` to set the `channels.stderr.formatter` to `Monolog\Formatter\JsonFormatter::class`.
152+
149153
## Usage
150154

151155
### Artisan Console

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"illuminate/queue": "^8.0 || ^9.0",
1818
"illuminate/support": "^8.0 || ^9.0",
1919
"laravel/octane": "^1.2",
20-
"monolog/monolog": "^2.0",
2120
"riverline/multipart-parser": "^2.0"
2221
},
2322
"require-dev": {

src/BrefServiceProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace CacheWerk\BrefLaravelBridge;
44

5-
use Monolog\Formatter\JsonFormatter;
6-
75
use Illuminate\Log\LogManager;
86

97
use Illuminate\Support\Facades\Config;
@@ -40,8 +38,6 @@ public function register()
4038

4139
Config::set('app.mix_url', Config::get('app.asset_url'));
4240

43-
Config::set('logging.channels.stderr.formatter', JsonFormatter::class);
44-
4541
Config::set('trustedproxy.proxies', ['0.0.0.0/0', '2000:0:0:0:0:0:0:0/3']);
4642

4743
Config::set('view.compiled', StorageDirectories::Path . '/framework/views');

0 commit comments

Comments
 (0)