123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?php
- /*
- * This file is part of the Jiannei/lumen-api-starter.
- *
- * (c) Jiannei <longjian.huang@foxmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- use Jiannei\Logger\Laravel\MongoLogger;
- use Monolog\Handler\NullHandler;
- use Monolog\Handler\StreamHandler;
- use Monolog\Handler\SyslogUdpHandler;
- return [
- /*
- |--------------------------------------------------------------------------
- | Default Log Channel
- |--------------------------------------------------------------------------
- |
- | This option defines the default log channel that gets used when writing
- | messages to the logs. The name specified in this option should match
- | one of the channels defined in the "channels" configuration array.
- |
- */
- 'default' => env('LOG_CHANNEL', 'stack'),
- /*
- |--------------------------------------------------------------------------
- | Log Channels
- |--------------------------------------------------------------------------
- |
- | Here you may configure the log channels for your application. Out of
- | the box, Laravel uses the Monolog PHP logging library. This gives
- | you a variety of powerful log handlers / formatters to utilize.
- |
- | Available Drivers: "single", "daily", "slack", "syslog",
- | "errorlog", "monolog",
- | "custom", "stack"
- |
- */
- 'channels' => [
- 'stack' => [
- 'driver' => 'stack',
- 'channels' => ['daily'],
- ],
- 'single' => [
- 'driver' => 'single',
- 'path' => storage_path('logs/lumen.log'),
- 'level' => 'debug',
- ],
- 'daily' => [
- 'driver' => 'daily',
- 'path' => storage_path('logs/lumen.log'),
- 'level' => 'debug',
- 'days' => 14,
- ],
- 'slack' => [
- 'driver' => 'slack',
- 'url' => env('LOG_SLACK_WEBHOOK_URL'),
- 'username' => 'Lumen Log',
- 'emoji' => ':boom:',
- 'level' => 'critical',
- ],
- 'papertrail' => [
- 'driver' => 'monolog',
- 'level' => 'debug',
- 'handler' => SyslogUdpHandler::class,
- 'handler_with' => [
- 'host' => env('PAPERTRAIL_URL'),
- 'port' => env('PAPERTRAIL_PORT'),
- ],
- ],
- 'stderr' => [
- 'driver' => 'monolog',
- 'handler' => StreamHandler::class,
- 'with' => [
- 'stream' => 'php://stderr',
- ],
- ],
- 'syslog' => [
- 'driver' => 'syslog',
- 'level' => 'debug',
- ],
- 'errorlog' => [
- 'driver' => 'errorlog',
- 'level' => 'debug',
- ],
- 'null' => [
- 'driver' => 'monolog',
- 'handler' => NullHandler::class,
- ],
- 'mongo' => [
- 'driver' => 'custom', // 此处必须为 `custom`
- 'via' => MongoLogger::class, // 当 `driver` 设置为 custom 时,使用 `via` 配置项所指向的工厂类创建 logger
- 'channel' => env('LOG_MONGODB_CHANNEL', 'mongo'),
- 'level' => env('LOG_MONGODB_LEVEL', 'debug'), // 日志级别
- 'separate' => env('LOG_MONGODB_SEPARATE', false), // false,daily,monthly,yearly
- 'host' => env('LOG_MONGODB_HOST', config('database.connections.mongodb.host')),
- 'port' => env('LOG_MONGODB_PORT', config('database.connections.mongodb.port')),
- 'username' => env('LOG_MONGODB_USERNAME', config('database.connections.mongodb.username')),
- 'password' => env('LOG_MONGODB_PASSWORD', config('database.connections.mongodb.password')),
- 'database' => env('LOG_MONGODB_DATABASE', config('database.connections.mongodb.database')),
- ],
- ],
- 'enum' => \App\Repositories\Enums\LogEnum::class,
- 'query' => [
- 'enabled' => env('LOG_QUERY', false),
- 'message' => 'query',
- 'connection' => env('LOG_QUERY_CONNECTION', config('queue.default')), // queue connection
- 'queue' => env('LOG_QUERY_QUEUE', 'default'), // queue name
- // Only record queries that are slower than the following time
- // Unit: milliseconds
- 'slower_than' => 0,
- ],
- 'request' => [
- 'enabled' => env('LOG_REQUEST', false),
- 'message' => 'request',
- 'connection' => env('LOG_REQUEST_CONNECTION', config('queue.default')), // queue connection
- 'queue' => env('LOG_REQUEST_QUEUE', 'default'), // queue name
- ],
- 'listener' => [
- 'requestArrivedListener' => \ZhMead\Logger\Laravel\Listeners\RequestArrivedListener::class,
- // 'requestHandledListener' => \ZhMead\Logger\Laravel\Listeners\RequestHandledListener::class,
- 'requestHandledListener' => \App\Listeners\RequestHandledListener::class,
- ],
- // 'job' => \ZhMead\Logger\Laravel\Jobs\LogJob::class,
- 'job' => \App\Jobs\LogJob::class,
- 'guard' => 'admins',
- ];
|