PHP code example of legalthings / cloudwatch-logger-php
1. Go to this page and download the library: Download legalthings/cloudwatch-logger-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
legalthings / cloudwatch-logger-php example snippets
use LegalThings/CloudWatchLogger;
$config = [
'aws' => [
'version' => 'latest',
'region' => 'eu-west-1',
'credentials' => [
'key' => 'my_key',
'secret' => 'my_secret'
]
],
'group_name' => 'group_name',
'stream_name' => 'stream_name'
];
$logger = new CloudWatchLogger($config);
$logger->log(['hello' => 'world']);
/*
outputs within the group 'group_name' and instance 'stream_name' on CloudWatch:
{
"hello": "world"
}
*/
[
// ' => [
// st',
// / optional, credentials may be omitted if using aws environment variables or roles
'credentials' => [
'key' => 'my_key',
'secret' => 'my_secret'
]
],
// en sequence exception), defaults to 5
'error_max_retry' => 3,
// delay to wait for before retrying logging in microseconds, defaults to 100000 microseconds (0.1 seconds)
'error_retry_delay' => 0
]
]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.