Skip to content

Commit 79a7799

Browse files
Merge pull request #1 from throttlehead-dev/dev/add-create-group-opt
Dev/add create group opt
2 parents d91ec6e + 0e905e0 commit 79a7799

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ Config for logging is defined at `config/logging.php`. Add `cloudwatch` to the `
4141
'group_name' => env('CLOUDWATCH_LOG_GROUP_NAME', 'laravel_app'),
4242
'version' => env('CLOUDWATCH_LOG_VERSION', 'latest'),
4343
'formatter' => \Monolog\Formatter\JsonFormatter::class,
44-
'batch_size' => env('CLOUDWATCH_LOG_BATCH_SIZE', 10000),
44+
'batch_size' => env('CLOUDWATCH_LOG_BATCH_SIZE', 10000),
45+
'create_group' => env('CLOUDWATCH_CREATE_GROUP', true)
4546
'via' => \Pagevamp\Logger::class,
4647
],
4748
]

src/Logger.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Pagevamp;
44

5+
use Monolog\Logger as MonoLogger;
56
use Aws\CloudWatchLogs\CloudWatchLogsClient;
67
use Maxbanton\Cwh\Handler\CloudWatch;
78
use Monolog\Formatter\LineFormatter;
@@ -29,9 +30,10 @@ public function __invoke(array $config)
2930
$streamName = $loggingConfig['stream_name'];
3031
$retentionDays = $loggingConfig['retention'];
3132
$groupName = $loggingConfig['group_name'];
33+
$createGroup = $loggingConfig['create_group'];
3234
$batchSize = isset($loggingConfig['batch_size']) ? $loggingConfig['batch_size'] : 10000;
3335

34-
$logHandler = new CloudWatch($cwClient, $groupName, $streamName, $retentionDays, $batchSize);
36+
$logHandler = new CloudWatch($cwClient, $groupName, $streamName, $retentionDays, $batchSize, [], MonoLogger::DEBUG, true, $createGroup);
3537
$logger = new \Monolog\Logger($loggingConfig['name']);
3638

3739
$formatter = $this->resolveFormatter($loggingConfig);

0 commit comments

Comments
 (0)