mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-24 18:16:10 +02:00
@@ -38,6 +38,7 @@
|
|||||||
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||||
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
||||||
|
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
||||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||||
"php-console/php-console": "Allow sending log messages to Google Chrome"
|
"php-console/php-console": "Allow sending log messages to Google Chrome"
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ class MongoDBHandler extends AbstractProcessingHandler
|
|||||||
|
|
||||||
public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true)
|
public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true)
|
||||||
{
|
{
|
||||||
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
|
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) {
|
||||||
throw new \InvalidArgumentException('MongoClient or Mongo instance required');
|
throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->mongoCollection = $mongo->selectCollection($database, $collection);
|
$this->mongoCollection = $mongo->selectCollection($database, $collection);
|
||||||
@@ -42,7 +42,11 @@ class MongoDBHandler extends AbstractProcessingHandler
|
|||||||
|
|
||||||
protected function write(array $record)
|
protected function write(array $record)
|
||||||
{
|
{
|
||||||
$this->mongoCollection->save($record["formatted"]);
|
if ($this->mongoCollection instanceof \MongoDB\Collection) {
|
||||||
|
$this->mongoCollection->insertOne($record["formatted"]);
|
||||||
|
} else {
|
||||||
|
$this->mongoCollection->save($record["formatted"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user