ydg / monolog-aliyun-log
让monolog支持阿里云日志。
v1.0.1
2023-03-22 07:22 UTC
Requires
- php: >=7.2
- alibabacloud/aliyun-log-php-sdk: ^0.6.3
- monolog/monolog: ^1.24 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.12
- phpunit/phpunit: ^9.5
- vlucas/phpdotenv: ^5.0
This package is auto-updated.
Last update: 2024-09-22 10:34:19 UTC
README
安装
使用以下命令安装最新版本:
$ 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');