34 if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) {
35 throw new \InvalidArgumentException(
'MongoClient, Mongo or MongoDB\Client instance required');
38 $this->mongoCollection = $mongo->selectCollection($database, $collection);
43 protected function write(array $record)
45 if ($this->mongoCollection instanceof \MongoDB\Collection) {
46 $this->mongoCollection->insertOne($record[
"formatted"]);
48 $this->mongoCollection->save($record[
"formatted"]);
An exception for terminatinating execution or to throw for unit testing.
Base Handler class providing the Handler structure.
Logs to a MongoDB database.
__construct($mongo, $database, $collection, $level=Logger::DEBUG, $bubble=true)
write(array $record)
Writes the record down to the log of the implementing handler.
getDefaultFormatter()
Gets the default formatter.FormatterInterface
const DEBUG
Detailed debug information.