cblink/monolog-handler

monolog aliyun handler

v3.0.0 2021-07-09 02:04 UTC

This package is auto-updated.

Last update: 2024-04-09 07:54:06 UTC


README

安装

composer require cblink/monolog-handler

支持的Handler列表

  • 阿里云log

在laravel框架中使用

  1. laravel 版本号大于 5.7+
  2. 修改项目中 app/logging.php文件,channels中添加aliyun driver,示例如下
// 将
return [
    // ...
    'channels' => [
        //... 
        
        // 添加此项
        'aliyun-log' => [
            'driver' => 'monolog',
            'level' => 'debug',
            'handler' => Cblink\Monolog\Handler\AliyunLogHandler::class,
            'handler_with' => [
                'access_id' =>  '阿里云控制台access_key_id',
                'access_key' => '阿里云控制台access_key_secret',
                'endpoint' => 'cn-shenzhen',    // 节点,无需填写 log.aliyuncs.com
                'projectName' => 'laravel-project',     // 日志服务中的项目名称
                'logName' => 'service-wechat'       // 日志名称
            ]
        ],
    ]   
];
  1. 修改.env配置文件LOG_CHANNEL值为aliyun-log
LOG_CHANNEL=aliyun-log

其他使用