alfredlib / aliyunsls-for-laravel
AliyunSLS for laravel
Installs: 37
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:HTML
README
运行环境
-
php
^7.0
-
Laravel
^6.0
安装
- 推荐使用composer安装,执行如下命令
composer require alfredlib/aliyunsls-for-laravel
- 注册Laravel服务, 在config/app.php 添加
'providers' => [ // ... 'Alfredlib\AliyunSls\AliyunSlsServiceProvider::class', ]
添加aliases配置
'aliases' => [ // ... 'Sls' => Alfredlib\AliyunSls\Facades\Sls::class, ]
- 发布资源,在config目录下生成一个aliyunsls.php文件
php artisan vendor:publish --provider="Alfredlib\AliyunSls\AliyunSlsServiceProvider"
添加配置项
在config/aliyunsls.php 中添加配置,您也可以在.env文件中添加对应配置项
return [ 'endpoint' => env('ALIYUN_SLS_ENDPOINT', ''), 'access_key' => env('ALIYUN_SLS_ACCESS_KEY', ''), 'access_secret' => env('ALIYUN_SLS_ACCESS_SECRET', ''), 'project' => env('ALIYUN_SLS_PROJECT', ''), 'default_logstore' => env('','test'), ]
使用举例
Sls Facade类提供了不同种日志级别写入函数:
Sls::info(); Sls::warning(); Sls::error(); Sls::debug();
依赖SDK
Aliyun Log Service PHP SDK,API VERSION 0.6.1
License
The code for Predis is distributed under the terms of the MIT license (see LICENSE).