MongoDB\add_logger()
New in version 1.17.
Definition
Parameters
$logger
: Psr\Log\LoggerInterfaceA logger to register.
If the logger is already registered, the method will have no effect.
Behavior
This function allows the application to register one or more Psr\Log\LoggerInterface objects to receive log messages from libmongoc and the extension. Each registered logger will receive messages for all clients.
Messages originating from the extension will have their log level translated to an equivalent PSR log level. For performance reasons, trace-level messages from the extension are not forwarded to PSR loggers. The extension's mongodb.debug INI configuration must be used to collect trace-level logs.
Log messages also include a domain string that identifies the driver component that emitted the log message. This value is provided to the PSR logger via the {{domain}} key of the context array.
Errors/Exceptions
MongoDB\Exception\InvalidArgumentException
for errors related to
the parsing of parameters or options.