1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-19 02:17:38 +03:00

Contributing: Document --trace-on code and usage

This commit is contained in:
Athanasius 2021-08-05 16:50:02 +01:00
parent 7a71fc8e14
commit ca87c061a1
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D

View File

@ -376,6 +376,22 @@ In addition to that we utilise one of the user-defined levels as:
command-line argument and `.bat` file for users to enable it. It cannot be
selected from Settings in the UI.
As well as just using bare `logger.trace(...)` you can also gate it to only
log if asked to at invocation time by utilising the `--trace-on ...`
command-line argument. e.g.
`EDMarketConnector.py --trace --trace-on edsm-cmdr-events`. Note how you
still need to include `--trace`. The code to check and log would be like:
```python
from config import trace_on
if 'edsm-cmdr-events' in trace_on:
logger.trace(f'De-queued ({cmdr=}, {entry["event"]=})')
```
This way you can set up TRACE logging that won't spam just because of
`--trace` being used.
---
## Use fstrings, not modulo-formatting or .format