megalut / sewpy

Source Extractor Wrapper for Python
GNU General Public License v3.0
22 stars 11 forks source link

Option to suppress warnings #14

Closed andrewrynhard closed 9 years ago

andrewrynhard commented 9 years ago

Minor request. It would be nice to suppress any warnings that sewpy outputs. Would it be possible to set an option upon instantiation?

mtewes commented 9 years ago

Thanks for the suggestion! I think that this makes sense, and I've added the option loglevel to the constructor of SEW. Setting loglevel="CRITICAL" will suppress all logs, as documented here: http://sewpy.readthedocs.org/en/latest/api.html#sewpy.sewpy.SEW Does that help ?

We're still learning on how to use this nice logging module. Note (also for us) that the above could also be achieved from "outside" of any given module. In a script that uses sewpy (for instance), one can

import logging
logging.getLogger("sewpy").setLevel(logging.CRITICAL)
andrewrynhard commented 9 years ago

@mtewes: thanks for the code update! Nice to know we can achieve the same with logging but even nicer that it is as simple as loglevel="CRITICAL".