CascadiaPHP 2024

The MongoDB\Driver\Monitoring\LogSubscriber interface

(mongodb >=1.17.0)


Classes implementing this interface may be registered as a subscriber and receive log messages from the extension. This is similar to stream-based debug logging (i.e. mongodb.debug) except that trace-level log messages are not received.

As with stream-based logging, it is only possible to register a logger globally using MongoDB\Driver\Monitoring\addSubscriber(). The extension is not able to distinguish log messages for individual MongoDB\Driver\Manager objects.


class MongoDB\Driver\Monitoring\LogSubscriber implements MongoDB\Driver\Monitoring\Subscriber {
/* 定数 */
const int LEVEL_ERROR = 0;
const int LEVEL_CRITICAL = 1;
const int LEVEL_WARNING = 2;
const int LEVEL_MESSAGE = 3;
const int LEVEL_INFO = 4;
const int LEVEL_DEBUG = 5;
/* メソッド */
abstract public log(int $level, string $domain, string $message): void



Error log level. An error condition that the extension is unable to report through its API. This is the most severe log level in the extension.


Critical log level. An error condition with slightly less severity. This constant exists for consistency with libmongoc; however, the extension is unlikely to use it in practice.


Warning log level. Indicates a situation where undesirable application behavior may occur.


Message or notice log level. Indicates an event that is unusual but not problematic.


Info log level. High-level information about normal driver behavior.


Debug log level. Detailed information that may be helpful when debugging an application.


add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top