* * 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), // Only record queries that are slower than the following time // Unit: milliseconds 'slower_than' => 0, ], 'request' => [ 'enabled' => env('LOG_REQUEST', false), ], ];