PHP code example of xyqweb / log

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

    

xyqweb / log example snippets




$log = new \xyqWeb\log\Log([
    'driver'  => 'ssdb',//only accept file or ssdb
    'host'    => 'xx.xxx.xxx.xxx',//ssdb only
    'port'    => 'xxxxx',//ssdb only
    'project' => 'xxx',//your project name
    'key'     => 'xxxx',//ssdb only
    'path'    => 'path'//log path
]);
$log->write('test.log', ['content' => 'this is test content']);
// You can add subdirectories here
$log->write('test/test.log', ['content' => 'this is test content']);


$log = new \xyqWeb\log\Log([
    'driver'  => 'ssdb',//only accept file or ssdb
    'host'    => 'xx.xxx.xxx.xxx',//ssdb only
    'port'    => 'xxxxx',//ssdb only
    'project' => 'xxx',//your project name
    'key'     => 'xxxx',//ssdb only
    'path'    => 'path'//log path
]);
$log->write('test.log', ['content' => 'this is test content']);
// You can add subdirectories here
$log->write('test/test.log', ['content' => 'this is test content']);

'components' => [
    'yiiLog' => [
        'class' => 'xyqWeb\log\YiiLog',
        'config'=>[
            'driver'  => 'ssdb',//only accept file or ssdb
            'host'    => 'xx.xxx.xxx.xxx',//ssdb only
            'port'    => 'xxxxx',//ssdb only
            'project' => 'xxx',//your project name
            'key'     => 'xxxx',//ssdb only
            'path'    => 'path'//log path
        ]
    ]
]

Yii::$app->yiiLog->->write('test.log', ['content' => 'this is test content']);
Yii::$app->yiiLog->write('test/test.log', ['content' => 'this is test content']);