From 2d7a1904b45ffab9c01cd06283efa26b2c89a732 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 5 Jul 2016 14:09:21 -0700 Subject: [PATCH] dbgtrace takes a level parameter --- hledger-lib/Hledger/Utils/Debug.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hledger-lib/Hledger/Utils/Debug.hs b/hledger-lib/Hledger/Utils/Debug.hs index 03f3990ae..4d8d0b53e 100644 --- a/hledger-lib/Hledger/Utils/Debug.hs +++ b/hledger-lib/Hledger/Utils/Debug.hs @@ -181,11 +181,11 @@ tracePrettyAtIO lvl lbl x = liftIO $ tracePrettyAt lvl lbl x `seq` return () -- tracePrettyAtM lvl lbl x = tracePrettyAt lvl lbl x `seq` return x -- | print this string to the console before evaluating the expression, --- if the global debug level is non-zero. Uses unsafePerformIO. -dbgtrace :: String -> a -> a -dbgtrace - | debugLevel > 0 = trace - | otherwise = flip const +-- if the global debug level is at or above the specified level. Uses unsafePerformIO. +dbgtrace :: Int -> String -> a -> a +dbgtrace level + | debugLevel >= level = trace + | otherwise = flip const -- | Print a showable value to the console, with a message, if the -- debug level is at or above the specified level (uses