ansasaki / abimap

A helper for library maintainers to use symbol versioning
MIT License
7 stars 1 forks source link

Script doesn't use the logging module #2

Closed tomato42 closed 6 years ago

tomato42 commented 6 years ago

https://github.com/ansasaki/symbol_version/blob/f441d3446bcb325df9a3ae440313d30da2646952/scripts/symbol_version.py#L31-L53

logging module supports sending messages to user, setting the specific debugging level, redirection of logs to file, formatting, etc.

simple usage looks like this, for logging place: https://github.com/tomato42/tlslite-ng/blob/5b3c7b6a4c8b7466bb31bc68301bf8c641b98b4a/tlslite/basedb.py#L28-L48 (note that the logger object is created in the method, not on the module level, that's because the logging module may be reconfigured between module load and function call)

and then enabling it: https://github.com/tomato42/tlslite-ng/blob/5b3c7b6a4c8b7466bb31bc68301bf8c641b98b4a/tests/tlstest.py#L1025-L1027

quite nice tutorial about logging module