Updated formatting of debug logging.

This commit is contained in:
Veronica K. B. Olsen
2018-09-29 15:10:34 +02:00
parent 46b22ff19d
commit c03db3205d
3 changed files with 9 additions and 6 deletions
+6 -6
View File
@@ -117,8 +117,8 @@ def main(sysArgs):
# Defaults # Defaults
debugLevel = logging.WARN debugLevel = logging.WARN
debugStr = "%(levelname)-8s %(message)s" debugStr = "{levelname:8} {message:}"
timeStr = "[%(asctime)s] " timeStr = "[{asctime:}] "
logFile = "" logFile = ""
toFile = False toFile = False
toStd = True toStd = True
@@ -149,7 +149,7 @@ def main(sysArgs):
debugLevel = logging.INFO debugLevel = logging.INFO
elif inArg == "DEBUG": elif inArg == "DEBUG":
debugLevel = logging.DEBUG debugLevel = logging.DEBUG
debugStr = "%(lineno)4d:%(name)-20s %(levelname)-8s %(message)s" debugStr = "{name:>20}:{lineno:<4d} {levelname:8} {message:}"
else: else:
print("Invalid debug level") print("Invalid debug level")
exit(2) exit(2)
@@ -160,10 +160,10 @@ def main(sysArgs):
toStd = False toStd = False
elif inOpt in ("--verbose"): elif inOpt in ("--verbose"):
debugLevel = VERBOSE debugLevel = VERBOSE
timeStr = "[%(asctime)s.%(msecs)03d] " timeStr = "[{asctime:}.{msecs:03.0f}] "
elif inOpt in ("--vverbose"): elif inOpt in ("--vverbose"):
debugLevel = VVERBOSE debugLevel = VVERBOSE
timeStr = "[%(asctime)s.%(msecs)03d] " timeStr = "[{asctime:}.{msecs:03.0f}] "
elif inOpt in ("-t","--time"): elif inOpt in ("-t","--time"):
showTime = True showTime = True
elif inOpt in ("--config"): elif inOpt in ("--config"):
@@ -173,7 +173,7 @@ def main(sysArgs):
# Set Logging # Set Logging
if showTime: debugStr = timeStr+debugStr if showTime: debugStr = timeStr+debugStr
logFmt = logging.Formatter(fmt=debugStr,datefmt="%Y-%m-%d %H:%M:%S") logFmt = logging.Formatter(fmt=debugStr,datefmt="%Y-%m-%d %H:%M:%S",style="{")
if not logFile == "" and toFile: if not logFile == "" and toFile:
if path.isfile(logFile+".bak"): if path.isfile(logFile+".bak"):
+2
View File
@@ -25,6 +25,7 @@ class GuiMain(QMainWindow):
def __init__(self): def __init__(self):
QWidget.__init__(self) QWidget.__init__(self)
logger.debug("Initialising GUI ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.resize(900,600) self.resize(900,600)
@@ -59,6 +60,7 @@ class GuiMain(QMainWindow):
self._buildMenu() self._buildMenu()
self.show() self.show()
logger.debug("GUI initialisation complete")
return return
+1
View File
@@ -25,4 +25,5 @@ class NovelWriter():
self.winMain = GuiMain() self.winMain = GuiMain()
return return
# END Class NovelWriter # END Class NovelWriter