imp: file reading: demote some debug=6 output to level 7

This commit is contained in:
Simon Michael 2025-07-11 13:48:58 -07:00
parent 536589e2c2
commit 08017366b5
2 changed files with 8 additions and 8 deletions

View File

@ -308,10 +308,10 @@ journalRenumberAccountDeclarations j = j{jdeclaredaccounts=jdas'}
-- it seems unneeded except perhaps for debugging -- it seems unneeded except perhaps for debugging
-- | Debug log the ordering of a journal's account declarations -- | Debug log the ordering of a journal's account declarations
-- (at debug level 5+). -- (at debug level 7+).
dbgJournalAcctDeclOrder :: String -> Journal -> Journal dbgJournalAcctDeclOrder :: String -> Journal -> Journal
dbgJournalAcctDeclOrder prefix = dbgJournalAcctDeclOrder prefix =
dbg5With ((prefix++) . showAcctDeclsSummary . jdeclaredaccounts) dbg7With ((prefix++) . showAcctDeclsSummary . jdeclaredaccounts)
where where
showAcctDeclsSummary :: [(AccountName,AccountDeclarationInfo)] -> String showAcctDeclsSummary :: [(AccountName,AccountDeclarationInfo)] -> String
showAcctDeclsSummary adis showAcctDeclsSummary adis

View File

@ -300,7 +300,7 @@ includedirectivep = do
lift followingcommentp lift followingcommentp
-- find file(s) -- find file(s)
let (mprefix,glb) = splitReaderPrefix prefixedglob let (mprefix,glb) = splitReaderPrefix prefixedglob
when (null $ dbg7 "glob pattern" glb) $ when (null $ dbg6 "include: glob pattern" glb) $
customFailure $ parseErrorAt off $ "include needs a file path or glob pattern argument" customFailure $ parseErrorAt off $ "include needs a file path or glob pattern argument"
paths <- getFilePaths2 off pos glb paths <- getFilePaths2 off pos glb
let prefixedpaths = case mprefix of let prefixedpaths = case mprefix of
@ -328,7 +328,7 @@ includedirectivep = do
realparentfilepath <- liftIO $ canonicalizePath parentfilepath -- Follow a symlink. If the path is already absolute, the operation never fails. realparentfilepath <- liftIO $ canonicalizePath parentfilepath -- Follow a symlink. If the path is already absolute, the operation never fails.
let curdir = takeDirectory realparentfilepath let curdir = takeDirectory realparentfilepath
-- Find all matched files, in lexicographic order (the order ls would normally show them) -- Find all matched files, in lexicographic order (the order ls would normally show them)
filepaths <- liftIO $ (dbg7 "include: matched files" . sort) <$> globDir1 fileglob curdir filepaths <- liftIO $ (dbg6 "include: matched files" . sort) <$> globDir1 fileglob curdir
if (not . null) filepaths if (not . null) filepaths
then pure filepaths then pure filepaths
else customFailure $ parseErrorAt parseroff $ "No files were matched by file pattern: " ++ fileglobpattern else customFailure $ parseErrorAt parseroff $ "No files were matched by file pattern: " ++ fileglobpattern
@ -350,7 +350,7 @@ includedirectivep = do
-- find all matched files, in lexicographic order (the order ls would normally show them) -- find all matched files, in lexicographic order (the order ls would normally show them)
filepaths <- liftIO $ filepaths <- liftIO $
dbg7 "include: matched files" dbg6 "include: matched files"
. map (cwd </>) . map (cwd </>)
-- . sort -- XXX needed ? -- . sort -- XXX needed ?
<$> <$>
@ -383,7 +383,7 @@ includedirectivep = do
-- defaulting to JournalReader. Duplicating readJournal a bit here. -- defaulting to JournalReader. Duplicating readJournal a bit here.
let r = fromMaybe reader $ findReader Nothing (Just prefixedpath) let r = fromMaybe reader $ findReader Nothing (Just prefixedpath)
parser = rParser r parser = rParser r
dbg6IO "parseIncludedFile: trying reader" (rFormat r) dbg7IO "parseIncludedFile: trying reader" (rFormat r)
-- Parse the file (and its own includes, if any) to a Journal -- Parse the file (and its own includes, if any) to a Journal
-- with file path and source text attached. Or throw an error. -- with file path and source text attached. Or throw an error.
@ -549,7 +549,7 @@ commoditydirectiveonelinep = do
pure $ (off, amt) pure $ (off, amt)
lift skipNonNewlineSpaces lift skipNonNewlineSpaces
_ <- lift followingcommentp _ <- lift followingcommentp
let comm = Commodity{csymbol=acommodity, cformat=Just $ dbg6 "style from commodity directive" astyle} let comm = Commodity{csymbol=acommodity, cformat=Just $ dbg7 "style from commodity directive" astyle}
if isNothing $ asdecimalmark astyle if isNothing $ asdecimalmark astyle
then customFailure $ parseErrorAt off pleaseincludedecimalpoint then customFailure $ parseErrorAt off pleaseincludedecimalpoint
else modify' (\j -> j{jdeclaredcommodities=M.insert acommodity comm $ jdeclaredcommodities j}) else modify' (\j -> j{jdeclaredcommodities=M.insert acommodity comm $ jdeclaredcommodities j})
@ -595,7 +595,7 @@ formatdirectivep expectedsym = do
then then
if isNothing $ asdecimalmark astyle if isNothing $ asdecimalmark astyle
then customFailure $ parseErrorAt off pleaseincludedecimalpoint then customFailure $ parseErrorAt off pleaseincludedecimalpoint
else return $ dbg6 "style from format subdirective" astyle else return $ dbg7 "style from format subdirective" astyle
else customFailure $ parseErrorAt off $ else customFailure $ parseErrorAt off $
printf "commodity directive symbol \"%s\" and format directive symbol \"%s\" should be the same" expectedsym acommodity printf "commodity directive symbol \"%s\" and format directive symbol \"%s\" should be the same" expectedsym acommodity