From c0540408a35a430314f54317e934dcd73dabf325 Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Sun, 10 Jan 2016 15:43:18 -0500 Subject: combox.log: rewrote docstrings. They're sphinx friendly now. --- ChangeLog | 1 + combox/log.py | 32 +++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7dec07b..cb35ac4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * combox/gui.py: Rewrote/Added docstrings; they're sphinx friendly now. + * combox/log.py: Rewrote doctrings; they're sphinx friendly now. * docs/api/combox.gui.rst: Added. * docs/api/index.rst: Added api/combox.gui to toctree. diff --git a/combox/log.py b/combox/log.py index c9a3214..2ff15cb 100644 --- a/combox/log.py +++ b/combox/log.py @@ -21,9 +21,24 @@ import logging def log_config(level, format_): - """Configures the logging module. + """Configures combox logging module. Called by all types of log functions in this module. + + :param int level: + Logging level. Must be any one of the following constants: + + - :const:`logging.CRITICAL` + - :const:`logging.DEBUG` + - :const:`logging.ERROR` + - :const:`logging.FATAL` + - :const:`logging.INFO` + - :const:`logging.WARN` + - :const:`logging.WARNING` + :param str format_: + Format string to pass to :func:`logging.basicConfig` + function. + """ logging.basicConfig(level=level, format=format_, @@ -32,14 +47,25 @@ def log_config(level, format_): def log_i(msg, format_='%(asctime)s - %(message)s'): """Function for logging information. + + :param str msg: + Log message. + :param str format_: + Format string to pass to :func:`log_config` function. + """ log_config(logging.INFO, format_=format_) logging.info(msg) def log_e(msg, format_='%(asctime)s - %(message)s'): - """ - Function for logging errors. + """Function for logging errors. + + :param str msg: + Log message. + :param str format_: + Format string to pass to :func:`log_config` function. + """ log_config(logging.ERROR, format_=format_) logging.error(msg) -- cgit v1.2.3