combox

split and encrypted files between online file storage providers
git clone git://git.ricketyspace.net/combox.git
Log | Files | Refs

commit c0540408a35a430314f54317e934dcd73dabf325
parent 97b5514d1fc3b81dc2bedae169d8197f6fcf24c8
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Sun, 10 Jan 2016 15:43:18 -0500

combox.log: rewrote docstrings.

They're sphinx friendly now.

Diffstat:
ChangeLog | 1+
combox/log.py | 32+++++++++++++++++++++++++++++---
2 files changed, 30 insertions(+), 3 deletions(-)

diff --git 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 @@ -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)