PHP code example of ddup / logger

1. Go to this page and download the library: Download ddup/logger 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/ */

    

ddup / logger example snippets


function getLogger($client){
    switch ($client){
        case "ali":
            return new \Ddup\Logger\Aliyun\AliyunLogger(
                new \Ddup\Logger\Aliyun\Config\AliyunLogStruct(
                    [
                        'access_key_id'     => '',
                        'access_key_secret' => '',
                        'endpoint'          => '',
                        'project'           => '',
                        'store'             => '',
                        'topic'             => ''
                    ]
                ));
        break;
        case "lazy":
            return new \Ddup\Logger\Cli\LazyLogger;
        break;
        default:
            return  new \Ddup\Logger\Cli\CliLogger;
    }   
}


getLogger("lazy")->info('不处理', [
    'con' => '登高一呼时才懂,始终在为你心痛'
]);

getLogger("ali")->info('写入阿里云', [
    'con' => '登高一呼时才懂,始终在为你心痛'
]);

getLogger("cli")->info('输出到终端', [
    'con' => '登高一呼时才懂,始终在为你心痛'
]);