PHP code example of index0h / yii2-log

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

    

index0h / yii2-log example snippets


....
'components' => [
    'log' => [
        'targets' => [
            ['class' => 'index0h\\log\\ElasticsearchTarget'],
        ....

....
'components' => [
    'log' => [
        'targets' => [
            ['class' => 'index0h\\log\\LogstashFileTarget'],
        ....

....
'components' => [
    'log' => [
        'targets' => [
            ['class' => 'index0h\\log\\LogstashTarget'],
            // Or UDP.
            [
                'class' => 'index0h\\log\\LogstashTarget',
                'dsn' => 'udp://localhost:3333'
            ],
            // Or unix socket file.
            [
                'class' => 'index0h\\log\\LogstashTarget',
                'dsn' => 'unix:///path/to/logstash.sock'
            ],
        ....

....
'components' => [
    'log' => [
        'targets' => [
            ['class' => 'index0h\\log\\RedisTarget'],
        ....