Added filemode support to setupLogger.

This allows log files to be appended to if desired.
This commit is contained in:
John Garland 2009-05-17 12:28:03 +00:00
parent ac418d5935
commit 100227f4e1
1 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ levels = {
"none": logging.CRITICAL,
"debug": logging.DEBUG
}
def setupLogger(level="error", filename=None):
def setupLogger(level="error", filename=None, filemode="w"):
"""
Sets up the basic logger and if `:param:filename` is set, then it will log
to that file instead of stdout.
@ -51,7 +51,7 @@ def setupLogger(level="error", filename=None):
format="[%(levelname)-8s] %(asctime)s %(module)s:%(lineno)d %(message)s",
datefmt="%H:%M:%S",
filename=filename,
filemode="w"
filemode=filemode
)
def setLoggerLevel(level):