Skip to content
Oliver Zehentleitner edited this page Mar 28, 2023 · 5 revisions

To configure the logging you can use the following example code.

Logging to a file

import logging
import os`

logging.getLogger("unicorn_binance_websocket_api")
logging.basicConfig(level=logging.DEBUG,
                    `filename=os.path.basename(__file__) + '.log',
                    `format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}",
                    `style="{")

Logging to your terminal (stdout)

import logging
import os`

logging.getLogger("unicorn_binance_websocket_api")
logging.basicConfig(level=logging.DEBUG,
                    `format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}",
                    `style="{")

Full example file: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/blob/master/example_logging.py