PHP code example of jiannei / laravel-logger

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

    

jiannei / laravel-logger example snippets


protected $middlewareGroups = [
    'api' => [
        \Jiannei\Logger\Laravel\Http\Middleware\RequestLog::class,// 加在这个地方
    ],
];

// bootstrap/app.php
$app->configure('logging');

$app->middleware([
    \Jiannei\Logger\Laravel\Http\Middleware\RequestLog::class,
]);


$app->register(\Jiannei\Logger\Laravel\Providers\ServiceProvider::class);

LOG_CHANNEL=mongo
LOG_SLACK_WEBHOOK_URL=
LOG_QUERY=true
LOG_REQUEST=true

# 如果使用的是 mongo channel 需要配置
LOG_MONGODB_SEPARATE=daily
LOG_MONGODB_LEVEL=debug
LOG_MONGODB_HOST=127.0.0.1
LOG_MONGODB_PORT=27017
LOG_MONGODB_DATABASE=logs
LOG_MONGODB_USERNAME=
LOG_MONGODB_PASSWORD=
LOG_MONGODB_AUTHENTICATION_DATABASE=admin

logger_async(LogEnum::SYSTEM_SQL, $arrayData);