imp: lib: dlog
This commit is contained in:
parent
d0c937a41b
commit
3c889cb565
@ -93,7 +93,7 @@ module Hledger.Utils.Debug (
|
|||||||
,module Debug.Trace
|
,module Debug.Trace
|
||||||
,useColorOnStdout
|
,useColorOnStdout
|
||||||
,useColorOnStderr
|
,useColorOnStderr
|
||||||
)
|
,dlog)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Control.Monad (when)
|
import Control.Monad (when)
|
||||||
@ -305,6 +305,10 @@ ptraceAtWith level f
|
|||||||
-- in trace (s++":"++nlorspace++intercalate "\n" ls') a
|
-- in trace (s++":"++nlorspace++intercalate "\n" ls') a
|
||||||
in trace p a
|
in trace p a
|
||||||
|
|
||||||
|
-- | Log a pretty-printed showable value to "./debug.log". Uses unsafePerformIO.
|
||||||
|
dlog :: Show a => a -> a
|
||||||
|
dlog x = unsafePerformIO $ appendFile "debug.log" (pshow x ++ "\n") >> return x
|
||||||
|
|
||||||
-- "dbg" would clash with megaparsec.
|
-- "dbg" would clash with megaparsec.
|
||||||
-- | Pretty-print a label and the showable value to the console, then return it.
|
-- | Pretty-print a label and the showable value to the console, then return it.
|
||||||
dbg0 :: Show a => String -> a -> a
|
dbg0 :: Show a => String -> a -> a
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user