summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2016-01-10 15:43:18 -0500
committerSiddharth Ravikumar <sravik@bgsu.edu>2016-01-10 15:43:18 -0500
commitc0540408a35a430314f54317e934dcd73dabf325 (patch)
tree9ae434da2712fa1dfc1ec378e5afb005c4a99ec6
parent97b5514d1fc3b81dc2bedae169d8197f6fcf24c8 (diff)
combox.log: rewrote docstrings.
They're sphinx friendly now.
-rw-r--r--ChangeLog1
-rw-r--r--combox/log.py32
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)