Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion source/logging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ logging library, see the `Python logging library documentation <https://docs.pyt
Examples
--------

The follwing example sets the global logging level to ``INFO``:
The following example sets the global logging level to ``INFO``:

.. code-block:: python

Expand All @@ -52,6 +52,13 @@ The following example sets the log level on the ``pymongo.command`` component to
import logging
logging.getLogger("pymongo.command").setLevel(logging.DEBUG)

Messages that the driver outputs will have the log level specified at the beginning of the
message, as shown by this example ``INFO`` message:

.. code-block:: none

INFO:pymongo.command:Command insert on namespace test.test_collection

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use an actual log message here, like this:

DEBUG:pymongo.command:{"clientId": {"$oid": "65cbe82614be1fc2beb4e4a9"}, "message": "Command started", "command": "{\"insert\": \"test\", \"ordered\": true, \"lsid\": {\"id\": {\"$binary\": {\"base64\": \"GI7ubVhPSsWd7+OwHEFx6Q==\", \"subType\": \"04\"}}}, \"$db\": \"db\", \"documents\": [{\"x\": 1, \"_id\": {\"$oid\": \"65cbe82614be1fc2beb4e4aa\"}}]}", "commandName": "insert", "databaseName": "db", "requestId": 1144108930, "operationId": 1144108930, "driverConnectionId": 1, "serverConnectionId": 3554, "serverHost": "localhost", "serverPort": 27017}


Configuring Truncation
----------------------

Expand Down
Loading