Added filemode support to setupLogger.
This allows log files to be appended to if desired.
This commit is contained in:
parent
ac418d5935
commit
100227f4e1
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue