Skip to content
monolog handler
PHP
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
LICENSE
composer.json
phpunit.xml
readme.md

readme.md

monolog handler

安装

composer require cblink/monolog-handler

支持的Handler列表

  • 阿里云log

在laravel框架中使用

  1. 修改项目中 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

其他使用

You can’t perform that action at this time.