LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
678 stars 166 forks source link

Move ubwa logging to new loggers #164

Closed xilopaint closed 2 years ago

xilopaint commented 3 years ago

Is your feature request related to a problem? Please describe. In Python the logging structure is inherited from the root logger. I think the choice of using the root logger for the logging events of a library is not a good practice and makes difficult for developers building their own logging structure.

Describe the solution you'd like Avoid using the root logger and create new loggers for ubwa modules. Here's some guidelines from Python docs:

A good convention to use when naming loggers is to use a module-level logger, in each module which uses logging, named as follows:

logger = logging.getLogger(__name__) This means that logger names track the package/module hierarchy, and it’s intuitively obvious where events are logged just from the logger name.

The root of the hierarchy of loggers is called the root logger. That’s the logger used by the functions debug(), info(), warning(), error() and critical(), which just call the same-named method of the root logger. The functions and the methods have the same signatures. The root logger’s name is printed as ‘root’ in the logged output.

oliver-zehentleitner commented 3 years ago

I would merge a PR

oliver-zehentleitner commented 2 years ago

Thanks to @kylematoba for the PR! It will be included in the next release!