PHP code example of liuwave / think-log-driver-sls

1. Go to this page and download the library: Download liuwave/think-log-driver-sls library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liuwave / think-log-driver-sls example snippets


    'sls' =>  [
            'type'  => \liuwave\think\log\driver\Sls::class,
            'debug' => false,
            'json'  => false,
              // 关闭通道日志写入
            'close'          => false,
              // 是否实时写入
            'realtime_write' => true,
            
            'use_fc'         => true,//是否使用函数计算内置的 fcLogger,
            //仅在函数计算 php runtime cli模式下有效,若为true,则以下配置可不填
            //若设置为true,但不在函数计算 cli模式下,会尝试使用日志服务 php SDK
            //参见[相关参考](#相关参考)
            'source'         => 'think',//来源
            'credentials'    => [//认证信息,false或array,若为false,则默认使用函数计算提供的context信息中的认证信息,
                                 //如设置为false,且不在函数计算环境下,则不会写入日志
              'AccessKeyId'     => 'your_access_key_id',
              'AccessKeySecret' => 'your_access_key_secret',
              'endpoint'        => 'cn-beijing.sls.aliyuncs.com',//region.sls.aliyuncs.com
              'project'         => 'your_sls_project_name',// 
              'logStore'        => 'your_sls_log_store_name',// 
              'topic'           => '',// 
            ],
          ]