Added --info flag and modified logging output a bit

This commit is contained in:
Veronica K. B. Olsen
2019-11-05 11:25:45 +01:00
parent 28d347c848
commit 709689cf55
4 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -77,10 +77,11 @@ def main(sysArgs=None):
sysArgs = sys.argv[1:]
# Valid Input Options
shortOpt = "hdDqtl:v"
shortOpt = "hdiqtl:v"
longOpt = [
"help",
"debug",
"info",
"verbose",
"quiet",
"time",
@@ -99,6 +100,7 @@ def main(sysArgs=None):
"Usage:\n"
" -h, --help Print this message.\n"
" -v, --version Print program version and exit.\n"
" -i, --info Print additional runtime information.\n"
" -d, --debug Print debug output.\n"
" --verbose Increase verbosity of debug output.\n"
" -q, --quiet Disable output to command line. Does not affect log file.\n"
@@ -141,6 +143,8 @@ def main(sysArgs=None):
elif inOpt in ("-v", "--version"):
print("%s %s Version %s" % (__package__,__status__,__version__))
sys.exit()
elif inOpt in ("-i", "--info"):
debugLevel = logging.INFO
elif inOpt in ("-d", "--debug"):
debugLevel = logging.DEBUG
debugStr = "{name:>30}:{lineno:<4d} {levelname:8} {message:}"
+1 -1
View File
@@ -531,7 +531,7 @@ class GuiDocEditor(QTextEdit):
def _addWord(self, theCursor):
theWord = theCursor.selectedText().strip()
logger.info("Added '%s' to project dictionary" % theWord)
logger.debug("Added '%s' to project dictionary" % theWord)
self.theDict.addWord(theWord)
self.hLight.setDict(self.theDict)
self.hLight.rehighlightBlock(theCursor.block())
+1 -1
View File
@@ -40,7 +40,7 @@ logger = logging.getLogger(__name__)
class GuiMain(QMainWindow):
def __init__(self):
QWidget.__init__(self)
QMainWindow.__init__(self)
logger.info("Starting %s" % nw.__package__)
logger.debug("Initialising GUI ...")
+1 -1
View File
@@ -598,7 +598,7 @@ class NWProject():
if not path.isdir(thePath):
try:
mkdir(thePath)
logger.info("Created folder %s" % thePath)
logger.debug("Created folder %s" % thePath)
except Exception as e:
self.makeAlert(["Could not create folder.",str(e)], nwAlert.ERROR)
return False