|
|
@@ -17,6 +17,7 @@ use MongoDB\Client;
|
|
|
use Monolog\Level;
|
|
|
use Monolog\Formatter\FormatterInterface;
|
|
|
use Monolog\Formatter\MongoDBFormatter;
|
|
|
+use Monolog\LevelName;
|
|
|
use Monolog\LogRecord;
|
|
|
|
|
|
/**
|
|
|
@@ -47,12 +48,8 @@ class MongoDBHandler extends AbstractProcessingHandler
|
|
|
* @param string $database Database name
|
|
|
* @param string $collection Collection name
|
|
|
*/
|
|
|
- public function __construct($mongodb, string $database, string $collection, $level = Level::Debug, bool $bubble = true)
|
|
|
+ public function __construct(Client|Manager $mongodb, string $database, string $collection, int|string|Level|LevelName $level = Level::Debug, bool $bubble = true)
|
|
|
{
|
|
|
- if (!($mongodb instanceof Client || $mongodb instanceof Manager)) {
|
|
|
- throw new \InvalidArgumentException('MongoDB\Client or MongoDB\Driver\Manager instance required');
|
|
|
- }
|
|
|
-
|
|
|
if ($mongodb instanceof Client) {
|
|
|
$this->collection = $mongodb->selectCollection($database, $collection);
|
|
|
} else {
|