Remove all verbose log entries

This commit is contained in:
Veronica Berglyd Olsen
2022-10-19 08:27:11 +02:00
parent 54fea1d28e
commit 8775b360d8
15 changed files with 79 additions and 98 deletions
+17 -18
View File
@@ -664,7 +664,7 @@ class GuiDocEditor(QTextEdit):
if theBlock:
self.setCursorPosition(theBlock.position())
self.docFooter.updateLineCount()
logger.verbose("Cursor moved to line %d", theLine)
logger.debug("Cursor moved to line %d", theLine)
return True
@@ -718,7 +718,7 @@ class GuiDocEditor(QTextEdit):
if not self._bigDoc:
self.spellCheckDocument()
logger.verbose("Spell check is set to '%s'", str(theMode))
logger.debug("Spell check is set to '%s'", str(theMode))
return True
@@ -728,7 +728,7 @@ class GuiDocEditor(QTextEdit):
of Qt 5.13, is to clear the text and put it back. This clears
the undo stack, so we only do it for big documents.
"""
logger.verbose("Running spell checker")
logger.debug("Running spell checker")
if self._spellCheck:
bfTime = time()
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
@@ -763,7 +763,7 @@ class GuiDocEditor(QTextEdit):
logger.error("Not a document action")
return False
logger.verbose("Requesting action: %s", theAction.name)
logger.debug("Requesting action: %s", theAction.name)
self._allowAutoReplace(False)
if theAction == nwDocAction.UNDO:
@@ -944,7 +944,7 @@ class GuiDocEditor(QTextEdit):
logger.error("Invalid keyword '%s'", keyWord)
return False
logger.verbose("Inserting keyword '%s'", keyWord)
logger.debug("Inserting keyword '%s'", keyWord)
theState = self.insertNewBlock("%s: " % keyWord)
return theState
@@ -1172,7 +1172,7 @@ class GuiDocEditor(QTextEdit):
spellCheck &= theWord != ""
if spellCheck:
logger.verbose("Looking up '%s' in the dictionary", theWord)
logger.debug("Looking up '%s' in the dictionary", theWord)
spellCheck &= not self.spEnchant.checkWord(theWord)
if spellCheck:
@@ -1238,11 +1238,11 @@ class GuiDocEditor(QTextEdit):
return
if self.wCounterDoc.isRunning():
logger.verbose("Word counter is busy")
logger.debug("Word counter is busy")
return
if time() - self._lastEdit < 5 * self.wcInterval:
logger.verbose("Running word counter")
logger.debug("Running word counter")
self.mainGui.threadPool.start(self.wCounterDoc)
return
@@ -1254,7 +1254,7 @@ class GuiDocEditor(QTextEdit):
if self._docHandle is None or self._nwItem is None:
return
logger.verbose("Updating word count")
logger.debug("Updating word count")
self._charCount = cCount
self._wordCount = wCount
@@ -1297,7 +1297,7 @@ class GuiDocEditor(QTextEdit):
return
if self.wCounterSel.isRunning():
logger.verbose("Selection word counter is busy")
logger.debug("Selection word counter is busy")
return
self.mainGui.threadPool.start(self.wCounterSel)
@@ -1311,7 +1311,7 @@ class GuiDocEditor(QTextEdit):
if self._docHandle is None or self._nwItem is None:
return
logger.verbose("User selectee %d words", wCount)
logger.debug("User selectee %d words", wCount)
self.docFooter.updateCounts(wCount=wCount, cCount=cCount)
self.wcTimerSel.stop()
@@ -1329,11 +1329,11 @@ class GuiDocEditor(QTextEdit):
QPointF(theSize.width(), theSize.height()), Qt.FuzzyHit
)
if self._queuePos <= thePos:
logger.verbose("Allowed cursor move to %d <= %d", self._queuePos, thePos)
logger.debug("Allowed cursor move to %d <= %d", self._queuePos, thePos)
self.setCursorPosition(self._queuePos)
self._queuePos = None
else:
logger.verbose("Denied cursor move to %d > %d", self._queuePos, thePos)
logger.debug("Denied cursor move to %d > %d", self._queuePos, thePos)
return
@@ -1520,7 +1520,7 @@ class GuiDocEditor(QTextEdit):
theCursor.endEditBlock()
theCursor.setPosition(theCursor.selectionEnd())
self.setTextCursor(theCursor)
logger.verbose(
logger.debug(
"Replaced occurrence of '%s' with '%s' on line %d",
searchFor, replWith, theCursor.blockNumber()
)
@@ -1898,10 +1898,10 @@ class GuiDocEditor(QTextEdit):
return False
if loadTag:
logger.verbose("Attempting to follow tag '%s'", theWord)
logger.debug("Attempting to follow tag '%s'", theWord)
self.loadDocumentTagRequest.emit(theWord, nwDocMode.VIEW)
else:
logger.verbose("Potential tag '%s'", theWord)
logger.debug("Potential tag '%s'", theWord)
return True
@@ -2431,7 +2431,6 @@ class GuiDocEditSearch(QFrame):
self.searchBox.selectAll()
if self.isRegEx:
self._alertSearchValid(True)
logger.verbose("Setting search text to '%s'", theText)
return True
def setReplaceText(self, theText):
@@ -2945,7 +2944,7 @@ class GuiDocEditFooter(QWidget):
"""
self._docHandle = tHandle
if self._docHandle is None:
logger.verbose("No handle set, so clearing the editor footer")
logger.debug("No handle set, so clearing the editor footer")
self._theItem = None
else:
self._theItem = self.theProject.tree[self._docHandle]
+14 -14
View File
@@ -241,7 +241,7 @@ class GuiDocViewer(QTextBrowser):
"""Wrapper function for various document actions on the current
document.
"""
logger.verbose("Requesting action: '%s'", theAction.name)
logger.debug("Requesting action: '%s'", theAction.name)
if self._docHandle is None:
logger.error("No document open")
return False
@@ -264,7 +264,7 @@ class GuiDocViewer(QTextBrowser):
if not isinstance(tAnchor, str):
return False
if tAnchor.startswith("#"):
logger.verbose("Moving to anchor '%s'", tAnchor)
logger.debug("Moving to anchor '%s'", tAnchor)
self.setSource(QUrl(tAnchor))
return True
@@ -350,7 +350,7 @@ class GuiDocViewer(QTextBrowser):
theBlock = self.document().findBlockByLineNumber(theLine)
if theBlock:
self.setCursorPosition(theBlock.position())
logger.verbose("Cursor moved to line %d", theLine)
logger.debug("Cursor moved to line %d", theLine)
return True
def setScrollPosition(self, thePos):
@@ -396,7 +396,7 @@ class GuiDocViewer(QTextBrowser):
"""Process a clicked link internally in the document.
"""
theLink = theURL.url()
logger.verbose("Clicked link: '%s'", theLink)
logger.debug("Clicked link: '%s'", theLink)
if len(theLink) > 0:
theBits = theLink.split("=")
if len(theBits) == 2:
@@ -578,7 +578,7 @@ class GuiDocViewHistory:
def clear(self):
"""Clear the view history.
"""
logger.verbose("View history cleared")
logger.debug("View history cleared")
self._navHistory = []
self._posHistory = []
self._currPos = -1
@@ -592,7 +592,7 @@ class GuiDocViewHistory:
"""
if self._currPos >= 0 and self._currPos < len(self._navHistory):
if tHandle == self._navHistory[self._currPos]:
logger.verbose("Not updating view hsitory")
logger.debug("Not updating view hsitory")
return False
self._truncateHistory(self._currPos)
@@ -607,7 +607,7 @@ class GuiDocViewHistory:
self._dumpHistory()
logger.verbose("Added '%s' to view history", tHandle)
logger.debug("Added '%s' to view history", tHandle)
return True
@@ -616,7 +616,7 @@ class GuiDocViewHistory:
"""
newPos = self._currPos + 1
if newPos < len(self._navHistory):
logger.verbose("Move forward in view history")
logger.debug("Move forward in view history")
self._prevPos = self._currPos
self._updateScrollBar()
@@ -634,7 +634,7 @@ class GuiDocViewHistory:
"""
newPos = self._currPos - 1
if newPos >= 0:
logger.verbose("Move backward in view history")
logger.debug("Move backward in view history")
self._prevPos = self._currPos
self._updateScrollBar()
@@ -680,11 +680,11 @@ class GuiDocViewHistory:
def _dumpHistory(self):
"""Debug function to dump history to the logger. Since it is a
for loop, it is skipped entirely if log level isn't VERBOSE.
for loop, it is skipped entirely if log level isn't DEBUG.
"""
if logger.getEffectiveLevel() < logging.DEBUG:
if logger.getEffectiveLevel() == logging.DEBUG:
for i, (h, p) in enumerate(zip(self._navHistory, self._posHistory)):
logger.verbose(
logger.debug(
"History %02d: %s %13s [x:%d]" % (
i + 1, ">" if i == self._currPos else " ", h, p
)
@@ -1104,7 +1104,7 @@ class GuiDocViewFooter(QWidget):
def _doToggleSticky(self, theState):
"""Toggle the sticky flag for the reference panel.
"""
logger.verbose("Reference sticky is %s", str(theState))
logger.debug("Reference sticky is %s", str(theState))
self.docViewer.stickyRef = theState
if not theState and self.docViewer.docHandle() is not None:
self.viewMeta.refreshReferences(self.docViewer.docHandle())
@@ -1199,7 +1199,7 @@ class GuiDocViewDetails(QScrollArea):
"""Capture the link-click and forward it to the document viewer
class for handling.
"""
logger.verbose("Clicked link: '%s'", theLink)
logger.debug("Clicked link: '%s'", theLink)
if len(theLink) == 21:
tHandle = theLink[:13]
tAnchor = theLink[13:]
+5 -5
View File
@@ -443,14 +443,14 @@ class GuiNovelTree(QTreeWidget):
def refreshTree(self, rootHandle=None, overRide=False):
"""Called whenever the Novel tab is activated.
"""
logger.verbose("Requesting refresh of the novel tree")
logger.debug("Requesting refresh of the novel tree")
if rootHandle is None:
rootHandle = self.theProject.tree.findRoot(nwItemClass.NOVEL)
treeChanged = self.mainGui.projView.changedSince(self._lastBuild)
indexChanged = self.theProject.index.rootChangedSince(rootHandle, self._lastBuild)
if not (treeChanged or indexChanged or overRide):
logger.verbose("No changes have been made to the novel index")
logger.debug("No changes have been made to the novel index")
return
selItem = self.selectedItems()
@@ -519,7 +519,7 @@ class GuiNovelTree(QTreeWidget):
tItem.setBackground(self.C_EXTRA, self.palette().base())
tItem.setBackground(self.C_MORE, self.palette().base())
logger.verbose("Highlighted Novel Tree in %.3f ms", (time() - tStart)*1000)
logger.debug("Highlighted Novel Tree in %.3f ms", (time() - tStart)*1000)
return
@@ -603,7 +603,7 @@ class GuiNovelTree(QTreeWidget):
"""
self.clearContent()
tStart = time()
logger.verbose("Building novel tree for root item '%s'", rootHandle)
logger.debug("Building novel tree for root item '%s'", rootHandle)
novStruct = self.theProject.index.novelStructure(rootHandle=rootHandle, skipExcl=True)
for tKey, tHandle, sTitle, novIdx in novStruct:
@@ -636,7 +636,7 @@ class GuiNovelTree(QTreeWidget):
self.setActiveHandle(self._actHandle)
logger.verbose("Novel Tree built in %.3f ms", (time() - tStart)*1000)
logger.debug("Novel Tree built in %.3f ms", (time() - tStart)*1000)
self._lastBuild = time()
return
+1 -3
View File
@@ -484,7 +484,7 @@ class GuiOutlineTree(QTreeWidget):
# was last built, we rebuild the tree from the updated index.
indexChanged = self.theProject.index.rootChangedSince(rootHandle, self._lastBuild)
if not (novelChanged or indexChanged or overRide):
logger.verbose("No changes have been made to the novel index")
logger.debug("No changes have been made to the novel index")
return
self._populateTree(rootHandle)
@@ -554,11 +554,9 @@ class GuiOutlineTree(QTreeWidget):
"""Receive the changes to column visibility forwarded by the
column selection menu.
"""
logger.verbose("User toggled Outline column '%s'", theItem.name)
if theItem in self._colIdx:
self.setColumnHidden(self._colIdx[theItem], not isChecked)
self._saveHeaderState()
return
##
+4 -4
View File
@@ -352,7 +352,7 @@ class GuiProjectToolBar(QWidget):
def buildQuickLinkMenu(self):
"""Build the quick link menu.
"""
logger.verbose("Rebuilding quick links menu")
logger.debug("Rebuilding quick links menu")
self.mQuick.clear()
for n, (tHandle, nwItem) in enumerate(self.theProject.tree.iterRoots(None)):
@@ -615,7 +615,7 @@ class GuiProjectTree(QTreeWidget):
tHandle = self.getSelectedHandle()
trItem = self._getTreeItem(tHandle)
if trItem is None:
logger.verbose("No item selected")
logger.debug("No item selected")
return False
pItem = trItem.parent()
@@ -760,7 +760,7 @@ class GuiProjectTree(QTreeWidget):
logger.info("Action cancelled by user")
return False
logger.verbose("Deleting %d file(s) from Trash", nTrash)
logger.debug("Deleting %d file(s) from Trash", nTrash)
for tHandle in reversed(self.getTreeFromHandle(trashHandle)):
if tHandle == trashHandle:
continue
@@ -986,7 +986,7 @@ class GuiProjectTree(QTreeWidget):
srcOK = isinstance(srcItem, QTreeWidgetItem)
dstOk = isinstance(dstItem, QTreeWidgetItem)
if not srcOK or not dstOk or dstIndex is None:
logger.verbose("No tree move to undo")
logger.debug("No tree move to undo")
return False
if srcItem not in self._treeMap.values():
+13 -13
View File
@@ -142,8 +142,8 @@ class GuiTheme:
self.guiDPI = qApp.primaryScreen().logicalDotsPerInchX()
self.guiScale = qApp.primaryScreen().logicalDotsPerInchX()/96.0
self.mainConf.guiScale = self.guiScale
logger.verbose("GUI DPI: %.1f", self.guiDPI)
logger.verbose("GUI Scale: %.2f", self.guiScale)
logger.debug("GUI DPI: %.1f", self.guiDPI)
logger.debug("GUI Scale: %.2f", self.guiScale)
# Fonts
self.guiFont = qApp.font()
@@ -160,12 +160,12 @@ class GuiTheme:
self.guiFontFixed.setPointSizeF(0.95*self.fontPointSize)
self.guiFontFixed.setFamily(QFontDatabase.systemFont(QFontDatabase.FixedFont).family())
logger.verbose("GUI Font Family: %s", self.guiFont.family())
logger.verbose("GUI Font Point Size: %.2f", self.fontPointSize)
logger.verbose("GUI Font Pixel Size: %d", self.fontPixelSize)
logger.verbose("GUI Base Icon Size: %d", self.baseIconSize)
logger.verbose("Text 'N' Height: %d", self.textNHeight)
logger.verbose("Text 'N' Width: %d", self.textNWidth)
logger.debug("GUI Font Family: %s", self.guiFont.family())
logger.debug("GUI Font Point Size: %.2f", self.fontPointSize)
logger.debug("GUI Font Pixel Size: %d", self.fontPixelSize)
logger.debug("GUI Base Icon Size: %d", self.baseIconSize)
logger.debug("Text 'N' Height: %d", self.textNHeight)
logger.debug("Text 'N' Width: %d", self.textNWidth)
return
@@ -358,7 +358,7 @@ class GuiTheme:
confParser = NWConfigParser()
for themeKey, themePath in self._availThemes.items():
logger.verbose("Checking theme config for '%s'", themeKey)
logger.debug("Checking theme config for '%s'", themeKey)
themeName = _loadInternalName(confParser, themePath)
if themeName:
self._themeList.append((themeKey, themeName))
@@ -375,7 +375,7 @@ class GuiTheme:
confParser = NWConfigParser()
for syntaxKey, syntaxPath in self._availSyntax.items():
logger.verbose("Checking theme syntax for '%s'", syntaxKey)
logger.debug("Checking theme syntax for '%s'", syntaxKey)
syntaxName = _loadInternalName(confParser, syntaxPath)
if syntaxName:
self._syntaxList.append((syntaxKey, syntaxName))
@@ -561,7 +561,7 @@ class GuiIcons:
iconPath = os.path.join(self._themePath, iconFile)
if os.path.isfile(iconPath):
self._themeMap[iconName] = iconPath
logger.verbose("Icon slot '%s' using file '%s'", iconName, iconFile)
logger.debug("Icon slot '%s' using file '%s'", iconName, iconFile)
else:
logger.error("Icon file '%s' not in theme folder", iconFile)
@@ -680,7 +680,7 @@ class GuiIcons:
if not os.path.isdir(themePath):
continue
logger.verbose("Checking icon theme config for '%s'", themeDir)
logger.debug("Checking icon theme config for '%s'", themeDir)
themeConf = os.path.join(themePath, self._confName)
themeName = _loadInternalName(confParser, themeConf)
if themeName:
@@ -728,7 +728,7 @@ class GuiIcons:
# Otherwise, we load from the theme folder
if iconKey in self._themeMap:
relPath = os.path.relpath(self._themeMap[iconKey], self._iconPath)
logger.verbose("Loading: %s", relPath)
logger.debug("Loading: %s", relPath)
return QIcon(self._themeMap[iconKey])
# If we didn't find one, give up and return an empty icon