summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2011-12-22 14:58:58 (GMT)
committerTim Bielawa <tbielawa@redhat.com>2011-12-22 14:58:58 (GMT)
commit28d56d2ddcc46205294fea7e16020c2321ee0447 (patch)
tree56b268013bf1670f1debe66ae5d0c6267478d8d3
parenteba2abbcc09a82ac67f578d0fbbd48f1f479280d (diff)
downloadTaboot-28d56d2ddcc46205294fea7e16020c2321ee0447.zip
Taboot-28d56d2ddcc46205294fea7e16020c2321ee0447.tar.gz
Taboot-28d56d2ddcc46205294fea7e16020c2321ee0447.tar.xz
Add more logging statements
-rw-r--r--taboot/cli.py3
-rw-r--r--taboot/log.py28
-rw-r--r--taboot/scripts.py5
3 files changed, 23 insertions, 13 deletions
diff --git a/taboot/cli.py b/taboot/cli.py
index 869d8e1..affea97 100644
--- a/taboot/cli.py
+++ b/taboot/cli.py
@@ -126,6 +126,7 @@ Taboot is released under the terms of the GPLv3+ license""")
valid = True
# Failed script validation WILL terminate this release
+ log_debug("Filtering for invalid scripts...")
for script in filter(lambda s: not s.valid, scripts.scripts):
valid = False
log_error("Could not parse %s", script.fileName)
@@ -149,7 +150,7 @@ Taboot is released under the terms of the GPLv3+ license""")
log_debug("Exiting due to invalid scripts.")
sys.exit(1)
else:
- log_debug("Executing main run loop in scripts object")
+ log_debug("Executing main run loop in scripts object.")
scripts.run()
if __name__ == '__main__':
diff --git a/taboot/log.py b/taboot/log.py
index 25774ee..d4d4d50 100644
--- a/taboot/log.py
+++ b/taboot/log.py
@@ -45,6 +45,9 @@ Each level includes all of the levels below it.
* ``Error`` - Severe errors that cause premature termination. This
would rarely be seen.
+For consistency, please follow this log-message style-guide:
+ - Use full sentences, and end them with FULL STOPS.
+ - Use ellipses when "doing xyz..."
Examples:
@@ -56,11 +59,11 @@ log_debug("Something is broken!!!")
log_debug("%s is broken!!!!", some_thing)
-log_debug("In %s there is a broken %s", something, thing)
+log_debug("In %s there is a broken %s.", something, thing)
-log_debug("In %s there is a broken %s", (something, thing))
+log_debug("In %s there is a broken %s.", (something, thing))
-log_debug("In %s there is a broken %s", [something, thing])
+log_debug("In %s there is a broken %s.", [something, thing])
"""
@@ -72,7 +75,8 @@ def log_wrap(origfunc):
boilerplate code in each log_XXX def was too painful to commit.
"""
def orig_func_wraper(msg, *args):
- # Take the callers name and snap it in two, result log level
+ # Take the callers name and snap it in two, result is log
+ # level, e.g.: log_debug is DEBUG level.
log_level = origfunc.__name__.split("_")[1]
import log
@@ -86,12 +90,12 @@ def log_wrap(origfunc):
def print_log_msg(log_level, msg):
- for l in msg.split("\n"):
- try:
+ try:
+ for l in msg.split("\n"):
print "%s: %s" % (log_level.upper(), l)
- except:
- # A logging mechanism never should cause a script to abort
- print "Error while processing %s message" % log_level.upper()
+ except:
+ # A logging mechanism never should cause a script to abort
+ print "Error while processing %s message" % log_level.upper()
@log_wrap
@@ -121,9 +125,9 @@ def _log_test():
log_debug("Something is broken!!!")
log_debug("%s is broken!!!!", some_thing)
- log_debug("In %s there is a broken %s", something, thing)
- log_debug("In %s there is a broken %s", (something, thing))
- log_debug("In %s there is a broken %s", [something, thing])
+ log_debug("In %s there is a broken %s.", something, thing)
+ log_debug("In %s there is a broken %s.", (something, thing))
+ log_debug("In %s there is a broken %s.", [something, thing])
if __name__ == "__main__":
diff --git a/taboot/scripts.py b/taboot/scripts.py
index 9d7aa68..510d127 100644
--- a/taboot/scripts.py
+++ b/taboot/scripts.py
@@ -32,6 +32,11 @@ class Scripts(object):
"""
def __init__(self, input_files, args, config):
+ """
+ - ``input_files`` should be a list of file names
+ - ``args`` should be the result of an argparser instance
+ - ``config`` is a dictionary of config values that aren't in ``args``
+ """
self.input_files = input_files
self.args = args
self.config = config