Python·100 questions

How to properly log (logging) instead of print?

Answer
import logging; log = logging.getLogger(__name__).
Use levels: debug/info/warning/error.
Configure format and handler.
Do not log secrets (tokens/passwords).
Do not configure root-logger in the library.
Was this answer helpful?

More questions in this topic

Related questions from other topics