ydg/monolog-aliyun-log

Let monolog support aliyun log.

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

This package is auto-updated.

Last update: 2024-06-22 10:03:10 UTC


README

Monolog Aliyu Log

Installation

Install the latest version with

$ composer require ydg/monolog-aliyun-log

Basic Usage

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