Remove verbose logging implementation
This commit is contained in:
@@ -72,32 +72,6 @@ __helpurl__ = "https://github.com/vkbo/novelWriter/discussions"
|
|||||||
__releaseurl__ = "https://github.com/vkbo/novelWriter/releases/latest"
|
__releaseurl__ = "https://github.com/vkbo/novelWriter/releases/latest"
|
||||||
__docurl__ = "https://novelwriter.readthedocs.io"
|
__docurl__ = "https://novelwriter.readthedocs.io"
|
||||||
|
|
||||||
##
|
|
||||||
# Logging
|
|
||||||
# =========
|
|
||||||
# Standard used for logging levels in novelWriter:
|
|
||||||
# CRITICAL Use for errors that result in termination of the program
|
|
||||||
# ERROR Use when an action fails, but execution continues
|
|
||||||
# WARNING When something unexpected, but non-critical happens
|
|
||||||
# INFO Any useful user information like open, save, exit initiated
|
|
||||||
# ----------- SPAM Threshold : Output above should be minimal -----------------
|
|
||||||
# DEBUG Use for descriptions of main program flow
|
|
||||||
# VERBOSE Use for outputting values and program flow details
|
|
||||||
##
|
|
||||||
|
|
||||||
# Add verbose logging level
|
|
||||||
VERBOSE = 5
|
|
||||||
logging.addLevelName(VERBOSE, "VERBOSE")
|
|
||||||
|
|
||||||
|
|
||||||
def logVerbose(self, message, *args, **kws):
|
|
||||||
if self.isEnabledFor(VERBOSE):
|
|
||||||
self._log(VERBOSE, message, args, **kws)
|
|
||||||
|
|
||||||
|
|
||||||
logging.Logger.verbose = logVerbose
|
|
||||||
|
|
||||||
# Initiating logging
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -122,7 +96,6 @@ def main(sysArgs=None):
|
|||||||
"version",
|
"version",
|
||||||
"info",
|
"info",
|
||||||
"debug",
|
"debug",
|
||||||
"verbose",
|
|
||||||
"style=",
|
"style=",
|
||||||
"config=",
|
"config=",
|
||||||
"data=",
|
"data=",
|
||||||
@@ -143,7 +116,6 @@ def main(sysArgs=None):
|
|||||||
" -v, --version Print program version and exit.\n"
|
" -v, --version Print program version and exit.\n"
|
||||||
" --info Print additional runtime information.\n"
|
" --info Print additional runtime information.\n"
|
||||||
" --debug Print debug output. Includes --info.\n"
|
" --debug Print debug output. Includes --info.\n"
|
||||||
" --verbose Increase verbosity of debug output. Includes --debug.\n"
|
|
||||||
" --style= Sets Qt5 style flag. Defaults to 'Fusion'.\n"
|
" --style= Sets Qt5 style flag. Defaults to 'Fusion'.\n"
|
||||||
" --config= Alternative config file.\n"
|
" --config= Alternative config file.\n"
|
||||||
" --data= Alternative user data path.\n"
|
" --data= Alternative user data path.\n"
|
||||||
@@ -181,9 +153,6 @@ def main(sysArgs=None):
|
|||||||
elif inOpt == "--debug":
|
elif inOpt == "--debug":
|
||||||
logLevel = logging.DEBUG
|
logLevel = logging.DEBUG
|
||||||
logFormat = "[{asctime:}] {filename:>17}:{lineno:<4d} {levelname:8} {message:}"
|
logFormat = "[{asctime:}] {filename:>17}:{lineno:<4d} {levelname:8} {message:}"
|
||||||
elif inOpt == "--verbose":
|
|
||||||
logLevel = VERBOSE
|
|
||||||
logFormat = "[{asctime:}] {filename:>17}:{lineno:<4d} {levelname:8} {message:}"
|
|
||||||
elif inOpt == "--style":
|
elif inOpt == "--style":
|
||||||
qtStyle = inArg
|
qtStyle = inArg
|
||||||
elif inOpt == "--config":
|
elif inOpt == "--config":
|
||||||
|
|||||||
@@ -111,12 +111,6 @@ def testBaseInit_Options(monkeypatch, tmpDir):
|
|||||||
assert novelwriter.logger.getEffectiveLevel() == logging.DEBUG
|
assert novelwriter.logger.getEffectiveLevel() == logging.DEBUG
|
||||||
assert nwGUI.closeMain() == "closeMain"
|
assert nwGUI.closeMain() == "closeMain"
|
||||||
|
|
||||||
nwGUI = novelwriter.main(
|
|
||||||
["--testmode", "--verbose", "--config=%s" % tmpDir, "--data=%s" % tmpDir]
|
|
||||||
)
|
|
||||||
assert novelwriter.logger.getEffectiveLevel() == 5
|
|
||||||
assert nwGUI.closeMain() == "closeMain"
|
|
||||||
|
|
||||||
# Help and Version
|
# Help and Version
|
||||||
with pytest.raises(SystemExit) as ex:
|
with pytest.raises(SystemExit) as ex:
|
||||||
nwGUI = novelwriter.main(
|
nwGUI = novelwriter.main(
|
||||||
|
|||||||
Reference in New Issue
Block a user