summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Šplíchal <psplicha@redhat.com>2011-10-08 14:39:24 +0200
committerPetr Šplíchal <psplicha@redhat.com>2011-10-08 14:39:24 +0200
commitcf87e057f9281b0d003c74c756b03f0e855aed5e (patch)
tree264b72bad00941a69d1913267172e379886b9c3d
parenta94028a451f14123c59309c19bef6c36d4f80c74 (diff)
downloadpython-nitrate-cf87e057f9281b0d003c74c756b03f0e855aed5e.tar.gz
python-nitrate-cf87e057f9281b0d003c74c756b03f0e855aed5e.tar.xz
python-nitrate-cf87e057f9281b0d003c74c756b03f0e855aed5e.zip
Nitrate: New functin info() for displaying info messages
-rw-r--r--Nitrate.py59
1 files changed, 42 insertions, 17 deletions
diff --git a/Nitrate.py b/Nitrate.py
index 60815f6..ebde369 100644
--- a/Nitrate.py
+++ b/Nitrate.py
@@ -9,12 +9,48 @@ custom level of logging and data caching. Supports results coloring.
Config file
~~~~~~~~~~~
-To be able to contact the nitrate server a minimal user configuration
+To be able to contact the Nitrate server a minimal user configuration
file ~/.nitrate has to be provided in the user home directory:
[nitrate]
url = https://nitrate.server/xmlrpc/
+Logging
+~~~~~~~
+
+Standard log methods from the python 'logging' module are available
+under the short name 'log', for example:
+
+ log.debug(message)
+ log.info(message)
+ log.warn(message)
+ log.error(message)
+
+By default, messages of level WARN and up are only displayed. This can
+be controlled by setting the current log level. See setLogLevel() for
+more details. In addition, you can easily display info messages using:
+
+ info(message)
+
+which prints provided message (to the standard error output) always,
+regardless the current log level.
+
+
+Search support
+~~~~~~~~~~~~~~
+
+Multiple Nitrate classes provide the static method 'search' which takes
+the search query in the Django QuerySet format which gives an easy
+access to the foreign keys and basic search operators. For example:
+
+ Product.search(name="Red Hat Enterprise Linux 6")
+ TestPlan.search(name__contains="python")
+ TestRun.search(manager__email='login@example.com'):
+ TestCase.search(script__startswith='/CoreOS/python')
+
+For the complete list of available operators see Django documentation:
+https://docs.djangoproject.com/en/dev/ref/models/querysets/#field-lookups
+
Test suite
~~~~~~~~~~~
@@ -48,22 +84,6 @@ only subset of tests pick the desired classes on the command line:
python Nitrate.py TestCase
-
-Search support
-~~~~~~~~~~~~~~
-
-Multiple Nitrate classes provide the static method 'search' which takes
-the search query in the Django QuerySet format which gives an easy
-access to the foreign keys and basic search operators. For example:
-
- Product.search(name="Red Hat Enterprise Linux 6")
- TestPlan.search(name__contains="python")
- TestRun.search(manager__email='login@example.com'):
- TestCase.search(script__startswith='/CoreOS/python')
-
-For the complete list of available operators see Django documentation:
-https://docs.djangoproject.com/en/dev/ref/models/querysets/#field-lookups
-
"""
import os
@@ -105,6 +125,11 @@ def setLogLevel(level=None):
setLogLevel()
+def info(message):
+ """ Log provided info message to the standard error output """
+
+ sys.stderr.write(message + "\n")
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Caching