'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['mongodb','single','slack'],
'ignore_exceptions' => false,
],
...
'mongodb' => [
'driver' => 'monolog',
'handler' => Monolog\Handler\MongoDBHandler::class,
'formatter' => 'default',
'handler_with' => [
'mongodb' => new \MongoDB\Client("mongodb://<user>:<pwd>@<host>:<prot>"),
'database' => "<庫>",
'collection' => '<collection>',
],
],
一定需要加 ‘formatter’ => ‘default’
如果設定了帳戶對應庫許可權,一般 authen_database == database
'mongodb' => new \MongoDB\Client("mongodb://<user>:<pwd>@<host>:<prot>/<authen_database>")
本作品採用《CC 協議》,轉載必須註明作者和本文連結