ydg/monolog-aliyun-log

让monolog支持阿里云日志。

v1.0.1 2023-03-22 07:22 UTC

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');