aliyun-sdk-project / php-log
Installs: 82
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/aliyun-sdk-project/php-log
Requires
- monolog/monolog: ^1.12 | ~2.0
 
This package is not auto-updated.
Last update: 2025-10-22 12:00:05 UTC
README
原来阿里云相关的日志很不好用,不能用composer 管理不方便,所以写了一个composer包进行管理,现在支持框架
- Yii2
 - lavarel
 
安装
composer require aliyun-sdk-project/php-log
Yii2 配置
'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'AliyunPHPLog\Yii2LogTarget',
                    'levels' => ['error', 'warning', 'info'],
                    'config' => [
                        'endpoint' => 'http://cn-hangzhou.log.aliyuncs.com/',
                        'accessKeyId' => '',
                        'accessKey' => '',
                        'project' => '',
                        'logstore' => '',
                    ],
                ],
            ],
        ],
project 是创建日志的项目名称。logstore 存储名称
Lavarel 配置
'aliyun' => [
            'driver' => 'monolog',
            'level' => 'debug',
            'handler' => AliyunPHPLog\LaravelLogHandler::class,
            'handler_with' => [
                'endpoint' => env('ALIYUN_ENDPOINT', 'http://cn-shenzhen.log.aliyuncs.com/'),
                'accessKeyId' => '',
                'accessKey' => '' ,
                'project' => '',
                'logstore' => '',
            ],
        ],