Toggle table of contents sidebar
event_loggers
– Example loggers¶
Example event logger classes.
Added in version 3.11.
These loggers can be registered using register()
or MongoClient
.
monitoring.register(CommandLogger())
or
MongoClient(event_listeners=[CommandLogger()])
See also
This module is compatible with both the synchronous and asynchronous PyMongo APIs.
A simple listener that logs command events.
Listens for CommandStartedEvent
, CommandSucceededEvent
and CommandFailedEvent
events and logs them at the INFO severity level using logging
. .. versionadded:: 3.11
Abstract method to handle a CommandFailedEvent.
event (CommandFailedEvent) – An instance of CommandFailedEvent
.
None
Abstract method to handle a CommandStartedEvent.
event (CommandStartedEvent) – An instance of CommandStartedEvent
.
None
Abstract method to handle a CommandSucceededEvent.
event (CommandSucceededEvent) – An instance of CommandSucceededEvent
.
None
A simple listener that logs server connection pool events.
Listens for PoolCreatedEvent
, PoolClearedEvent
, PoolClosedEvent
, :~pymongo.monitoring.class:ConnectionCreatedEvent, ConnectionReadyEvent
, ConnectionClosedEvent
, ConnectionCheckOutStartedEvent
, ConnectionCheckOutFailedEvent
, ConnectionCheckedOutEvent
, and ConnectionCheckedInEvent
events and logs them at the INFO severity level using logging
.
Added in version 3.11.
Abstract method to handle a ConnectionCheckOutFailedEvent
.
Emitted when the driver’s attempt to check out a connection fails.
event (ConnectionCheckOutFailedEvent) – An instance of ConnectionCheckOutFailedEvent
.
None
Abstract method to handle a ConnectionCheckOutStartedEvent
.
Emitted when the driver starts attempting to check out a connection.
event (ConnectionCheckOutStartedEvent) – An instance of ConnectionCheckOutStartedEvent
.
None
Abstract method to handle a ConnectionCheckedInEvent
.
Emitted when the driver checks in a connection back to the connection Pool.
event (ConnectionCheckedInEvent) – An instance of ConnectionCheckedInEvent
.
None
Abstract method to handle a ConnectionCheckedOutEvent
.
Emitted when the driver successfully checks out a connection.
event (ConnectionCheckedOutEvent) – An instance of ConnectionCheckedOutEvent
.
None
Abstract method to handle a ConnectionClosedEvent
.
Emitted when a connection Pool closes a connection.
event (ConnectionClosedEvent) – An instance of ConnectionClosedEvent
.
None
Abstract method to handle a ConnectionCreatedEvent
.
Emitted when a connection Pool creates a Connection object.
event (ConnectionCreatedEvent) – An instance of ConnectionCreatedEvent
.
None
Abstract method to handle a ConnectionReadyEvent
.
Emitted when a connection has finished its setup, and is now ready to use.
event (ConnectionReadyEvent) – An instance of ConnectionReadyEvent
.
None
Abstract method to handle a PoolClearedEvent.
Emitted when a connection Pool is cleared.
event (PoolClearedEvent) – An instance of PoolClearedEvent
.
None
Abstract method to handle a PoolClosedEvent.
Emitted when a connection Pool is closed.
event (PoolClosedEvent) – An instance of PoolClosedEvent
.
None
Abstract method to handle a PoolCreatedEvent
.
Emitted when a connection Pool is created.
event (PoolCreatedEvent) – An instance of PoolCreatedEvent
.
None
Abstract method to handle a PoolReadyEvent
.
Emitted when a connection Pool is marked ready.
event (PoolReadyEvent) – An instance of PoolReadyEvent
.
None
Added in version 4.0.
A simple listener that logs server heartbeat events.
Listens for ServerHeartbeatStartedEvent
, ServerHeartbeatSucceededEvent
, and ServerHeartbeatFailedEvent
events and logs them at the INFO severity level using logging
.
Added in version 3.11.
Abstract method to handle a ServerHeartbeatFailedEvent.
event (ServerHeartbeatFailedEvent) – An instance of ServerHeartbeatFailedEvent
.
None
Abstract method to handle a ServerHeartbeatStartedEvent.
event (ServerHeartbeatStartedEvent) – An instance of ServerHeartbeatStartedEvent
.
None
Abstract method to handle a ServerHeartbeatSucceededEvent.
event (ServerHeartbeatSucceededEvent) – An instance of ServerHeartbeatSucceededEvent
.
None
A simple listener that logs server discovery events.
Listens for ServerOpeningEvent
, ServerDescriptionChangedEvent
, and ServerClosedEvent
events and logs them at the INFO severity level using logging
.
Added in version 3.11.
Abstract method to handle a ServerClosedEvent.
event (ServerClosedEvent) – An instance of ServerClosedEvent
.
None
Abstract method to handle a ServerDescriptionChangedEvent.
event (ServerDescriptionChangedEvent) – An instance of ServerDescriptionChangedEvent
.
None
Abstract method to handle a ServerOpeningEvent.
event (ServerOpeningEvent) – An instance of ServerOpeningEvent
.
None
A simple listener that logs server topology events.
Listens for TopologyOpenedEvent
, TopologyDescriptionChangedEvent
, and TopologyClosedEvent
events and logs them at the INFO severity level using logging
.
Added in version 3.11.
Abstract method to handle a TopologyClosedEvent.
event (TopologyClosedEvent) – An instance of TopologyClosedEvent
.
None
Abstract method to handle a TopologyDescriptionChangedEvent.
event (TopologyDescriptionChangedEvent) – An instance of TopologyDescriptionChangedEvent
.
None
Abstract method to handle a TopologyOpenedEvent.
event (TopologyOpenedEvent) – An instance of TopologyOpenedEvent
.
None
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4