Currently when using cmdstanpy, a decent bit of logging is produced by default that is handled by the built-in logging library. This isn't always desired and the documentation details how it can be disabled:
import logging
import cmdstanpy
cmdstanpy_logger = logging.getLogger("cmdstanpy")
cmdstanpy_logger.disabled = True
or to set debug logs:
import logging
import cmdstanpy
cmdstanpy_logger = logging.getLogger("cmdstanpy")
cmdstanpy_logger.setLevel(logging.DEBUG)
while functional, it's somewhat clunky and requires users add a separate import and remember the details of how to work with the Python logging library. What I am envisioning is some helper functions at the module level that can act as shortcuts to these behaviors. So, something like:
import cmdstanpy
cmdstanpy.disable_logging()
would be shorthand for the first example. A corresponding cmdstanpy.enable_logging() would go along with it. Log levels could be similar:
import cmdstanpy
cmdstanpy.set_logging_level("DEBUG")
The lower-level interface of using the logging library directly could still be used, but this would simplify the process for end users.
Curious to hear what the maintainers think (this has been a minor annoyance as a user of the library), and if interesting, I'd be happy to contribute a PR.
Currently when using
cmdstanpy, a decent bit of logging is produced by default that is handled by the built-inlogginglibrary. This isn't always desired and the documentation details how it can be disabled:or to set debug logs:
while functional, it's somewhat clunky and requires users add a separate import and remember the details of how to work with the Python
logginglibrary. What I am envisioning is some helper functions at the module level that can act as shortcuts to these behaviors. So, something like:would be shorthand for the first example. A corresponding
cmdstanpy.enable_logging()would go along with it. Log levels could be similar:The lower-level interface of using the
logginglibrary directly could still be used, but this would simplify the process for end users.Curious to hear what the maintainers think (this has been a minor annoyance as a user of the library), and if interesting, I'd be happy to contribute a PR.