Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'group_name' => env('CLOUDWATCH_LOG_GROUP_NAME', 'laravel_app'),
'version' => env('CLOUDWATCH_LOG_VERSION', 'latest'),
'batch_size' => env('CLOUDWATCH_LOG_BATCH_SIZE', 10000),
'rps_limit' => env('CLOUDWATCH_LOG_RPS_LIMIT', 0),
'formatter' => function ($configs) {
return new \Monolog\Formatter\LineFormatter(
'%channel%: %level_name%: %message% %context% %extra%',
Expand Down
18 changes: 16 additions & 2 deletions src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Pagevamp;

use Aws\CloudWatchLogs\CloudWatchLogsClient;
use Monolog\Level;
use PhpNexus\Cwh\Handler\CloudWatch;
use Monolog\Formatter\LineFormatter;
use Pagevamp\Exceptions\IncompleteCloudWatchConfig;
Expand Down Expand Up @@ -30,8 +31,21 @@ public function __invoke(array $config)
$retentionDays = $loggingConfig['retention'];
$groupName = $loggingConfig['group_name'];
$batchSize = isset($loggingConfig['batch_size']) ? $loggingConfig['batch_size'] : 10000;

$logHandler = new CloudWatch($cwClient, $groupName, $streamName, $retentionDays, $batchSize);
$rpsLimit = isset($loggingConfig['rps_limit']) ? $loggingConfig['rps_limit'] : 0;

$logHandler = new CloudWatch(
$cwClient,
$groupName,
$streamName,
$retentionDays,
$batchSize,
[],
Level::Debug,
true,
true,
true,
$rpsLimit
);
$logger = new \Monolog\Logger($loggingConfig['name']);

$formatter = $this->resolveFormatter($loggingConfig);
Expand Down