crcms / logger
Mongodb log extension based on laravel logs.
Installs: 1 597
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.2.4
- illuminate/log: ^5.7
- jenssegers/mongodb: ^3.4
Requires (Dev)
- mockery/mockery: ^1.2
- phpunit/phpunit: ^7.4
This package is auto-updated.
Last update: 2024-11-07 04:22:21 UTC
README
Mongodb log extension based on laravel logs
Install
composer require crcms/logger
Config
Modify the following two configuration files
config/logging.php
use CrCms\Log\MongoDBLogger; 'channels' => [ 'mongo' => [ 'driver' => 'custom', // If it is empty, the default app.env //'name' => env('APP_ENV', 'production'), 'via' => MongoDBLogger::class, 'level' => 'debug', 'database' => [ 'driver' => 'mongodb', // If it is empty, the default database will be selected. 'database' => 'logger', 'collection' => 'logger', ], ], ]
config/database.php
'connections' => [ 'mongodb' => [ 'driver' => 'mongodb', 'host' => env('DB_MONGO_HOST', 'localhost'), 'port' => env('DB_MONGO_PORT', 27017), 'database' => env('DB_MONGO_DATABASE'), 'username' => env('DB_MONGO_USERNAME'), 'password' => env('DB_MONGO_PASSWORD'), 'options' => [ 'database' => env('DB_MONGO_AUTH_DATABASE', 'admin') ] ], ]