Here is a small test script to exercise the functions of
the Log object.
#!/usr/bin/env python
#================================================================
# Test driver for the Log class.
#
# Do not edit this file. It is extracted automatically from the
# documentation:
# http://www.nmt.edu/tcc/help/lang/python/examples/logscan/
#----------------------------------------------------------------
from logscan import *
# - - - m a i n
def main():
'''Test the Log class.
'''
NOTE_KIND = "Note"
Log().message("Sent only to ", "stderr.")
Log().addLogFile('a.log')
Log().msgKind(NOTE_KIND, "This should be sent to a.log\n"
"but not to b.log.")
Log().setPrefix('%%%% ')
Log().msgKind(NOTE_KIND, "This should be prefixed with percents\n"
"and not stars.")
Log().addLogFile('b.log')
Log().warning("This should appear in both a.log and b.log.")
Log().error("This is an error message.")
print "Count of errors, should be 1:", Log().count()
print "Count of warnings, should be 1:", Log().count(WARNING_KIND)
print "Count of notes, should be 2:", Log().count(NOTE_KIND)
print "And now, the fatal test:"
Log().fatal("This is the fatal message.")
print "This message had better not appear!"
#================================================================
# Epilogue
#----------------------------------------------------------------
if __name__ == '__main__':
main()