timrutte/laminas-log-writer-cloudwatch

Log writer to send all logs to AWS Cloudwatch

v1.0 2023-02-24 20:06 UTC

This package is auto-updated.

Last update: 2024-04-24 22:52:49 UTC


README

Log writer to send all logs to AWS Cloudwatch.

Installation

Run the following to install this library:

$ composer require timrutte/laminas-log-writer-cloudwatch

Usage

$writer = new \TimRutte\Laminas\Log\Writer\Cloudwatch();
$writer->configureAws(
    '<AWS_ACCESS_KEY>', 
    '<AWS_SECRET_KEY>', 
    '<AWS_REGION>', 
    '<CLOUDWATCH_GROUP_NAME>', 
    '<CLOUDWATCH_STREAM_NAME>'
);
$formatter = new \Laminas\Log\Formatter\Json();
$writer->setFormatter($formatter);
$logger = new \Laminas\Log\Logger();
$logger->addWriter($writer);

Support