Skip to content

Commit

Permalink
Make optional logging as JSON (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli authored Jan 30, 2023
1 parent 26b34ab commit 74e626c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v2.0.0]
### Breaking Changes
- 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`.

## [Unreleased]
## [v0.3.0] - 2022-11-15
### Changed
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ functions:
OCTANE_PERSIST_DATABASE_SESSIONS: 1
```

### JSON logs

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`.

## Usage

### Artisan Console
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"illuminate/queue": "^8.0 || ^9.0",
"illuminate/support": "^8.0 || ^9.0",
"laravel/octane": "^1.2",
"monolog/monolog": "^2.0",
"riverline/multipart-parser": "^2.0"
},
"require-dev": {
Expand Down
4 changes: 0 additions & 4 deletions src/BrefServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace CacheWerk\BrefLaravelBridge;

use Monolog\Formatter\JsonFormatter;

use Illuminate\Log\LogManager;

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

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

Config::set('logging.channels.stderr.formatter', JsonFormatter::class);

Config::set('trustedproxy.proxies', ['0.0.0.0/0', '2000:0:0:0:0:0:0:0/3']);

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

0 comments on commit 74e626c

Please sign in to comment.