You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting_started.rst
+97-5Lines changed: 97 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,14 +94,106 @@ For Python, you can use the bootstrap list to connect to known peers:
94
94
Debugging
95
95
---------
96
96
97
-
When running libp2p you may want to see what things are happening behind the scenes. You can enable debug logging by setting the appropriate log level:
97
+
When running libp2p you may want to see what things are happening behind the scenes. You can enable debug logging using the `LIBP2P_DEBUG` environment variable. This allows for fine-grained control over which modules log at which levels.
98
98
99
-
.. code:: python
99
+
Basic Usage
100
+
~~~~~~~~~~~
101
+
102
+
To enable debug logging for all modules:
103
+
104
+
.. code:: bash
105
+
106
+
# Method 1: Using export (persists for the shell session)
107
+
# On Unix-like systems (Linux, macOS):
108
+
export LIBP2P_DEBUG=DEBUG
109
+
# On Windows (Command Prompt):
110
+
set LIBP2P_DEBUG=DEBUG
111
+
# On Windows (PowerShell):
112
+
$env:LIBP2P_DEBUG="DEBUG"
113
+
114
+
# Method 2: Setting for a single command
115
+
# On Unix-like systems:
116
+
LIBP2P_DEBUG=DEBUG python your_script.py
117
+
# On Windows (Command Prompt):
118
+
set LIBP2P_DEBUG=DEBUG && python your_script.py
119
+
# On Windows (PowerShell):
120
+
$env:LIBP2P_DEBUG="DEBUG"; python your_script.py
121
+
122
+
# Method 3: Redirect logs to /dev/null to suppress console output
By default, logs are written to a file in the system's temporary directory with a timestamp and unique identifier. The file path is printed to stderr when logging starts.
154
+
155
+
When no custom log file is specified:
156
+
- Logs are written to both a default file and to stderr (console output)
157
+
- The default file path is printed to stderr when logging starts
158
+
159
+
When a custom log file is specified:
160
+
- Logs are written only to the specified file
161
+
- No console output is generated
162
+
163
+
To specify a custom log file location:
164
+
165
+
.. code:: bash
166
+
167
+
# Method 1: Using export (persists for the shell session)
0 commit comments