Install the latest version with
$ composer require ydg/monolog-aliyun-log
<?php
use Monolog\Logger;
use Hdk\MonologAliyunLog\AliyunLogHelper;
$config = [
'endpoint' => 'your endpoint',
'accessKeyId' => 'your accessKeyId',
'accessKey' => 'your accessKey',
'project' => 'your project',
'logstore' => 'your logstore',
];
$log = new Logger('name');
$log->pushHandler(AliyunLogHelper::getLogHandler(AliyunLogHelper::getLogClient($config), $config));
// add records to the log
$log->warning('Foo');
$log->error('Bar');