dev: lib: support debug logging to file in a few more places for hledger-ui

This commit is contained in:
Simon Michael 2022-11-06 08:57:26 -10:00
parent 9a8a8a75a2
commit 78771e900b
3 changed files with 8 additions and 8 deletions

View File

@ -244,7 +244,7 @@ priceLookup makepricegraph d from mto =
,pgEdgesRev=allprices
,pgDefaultValuationCommodities=defaultdests
} =
traceAt 1 ("valuation date: "++show d) $ makepricegraph d
traceOrLogAt 1 ("valuation date: "++show d) $ makepricegraph d
mto' = mto <|> mdefaultto
where
mdefaultto = dbg1 ("default valuation commodity for "++T.unpack from) $
@ -258,10 +258,10 @@ priceLookup makepricegraph d from mto =
-- according to the rules described in makePriceGraph.
let msg = printf "seeking %s to %s price" (showCommoditySymbol from) (showCommoditySymbol to)
in case
(traceAt 2 (msg++" using forward prices") $
(traceOrLogAt 2 (msg++" using forward prices") $
pricesShortestPath from to forwardprices)
<|>
(traceAt 2 (msg++" using forward and reverse prices") $
(traceOrLogAt 2 (msg++" using forward and reverse prices") $
pricesShortestPath from to allprices)
of
Nothing -> Nothing

View File

@ -299,7 +299,7 @@ includedirectivep = do
Fail.fail ("Cyclic include: " ++ filepath)
childInput <-
traceAt 6 ("parseChild: "++takeFileName filepath) $
traceOrLogAt 6 ("parseChild: "++takeFileName filepath) $
lift $ readFilePortably filepath
`orRethrowIOError` (show parentpos ++ " reading " ++ filepath)
let initChildj = newJournalWithParseStateFrom filepath parentj

View File

@ -121,16 +121,16 @@ accountTransactionsReport rspec@ReportSpec{_rsReportOpts=ropts} j thisacctq = it
-- want to keep prices around, so we can toggle between cost and no cost quickly. We can use
-- the show_costs_ flag to be efficient when we can, and detailed when we have to.
(if show_costs_ ropts then id else journalMapPostingAmounts mixedAmountStripPrices)
. traceAtWith 5 (("ts3:\n"++).pshowTransactions.jtxns)
. traceOrLogAtWith 5 (("ts3:\n"++).pshowTransactions.jtxns)
-- maybe convert these transactions to cost or value
. journalApplyValuationFromOpts rspec
. traceAtWith 5 (("ts2:\n"++).pshowTransactions.jtxns)
. traceOrLogAtWith 5 (("ts2:\n"++).pshowTransactions.jtxns)
-- apply any cur:SYM filters in reportq
. (if queryIsNull amtq then id else filterJournalAmounts amtq)
-- only consider transactions which match thisacctq (possibly excluding postings
-- which are not real or have the wrong status)
. traceAt 3 ("thisacctq: "++show thisacctq)
$ traceAtWith 5 (("ts1:\n"++).pshowTransactions.jtxns)
. traceOrLogAt 3 ("thisacctq: "++show thisacctq)
$ traceOrLogAtWith 5 (("ts1:\n"++).pshowTransactions.jtxns)
j{jtxns = filter (matchesTransaction thisacctq . relevantPostings) $ jtxns j}
where
relevantPostings