mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 21:02:04 +03:00
imp: lib: dlog
This commit is contained in:
parent
d0c937a41b
commit
3c889cb565
@ -93,7 +93,7 @@ module Hledger.Utils.Debug (
|
||||
,module Debug.Trace
|
||||
,useColorOnStdout
|
||||
,useColorOnStderr
|
||||
)
|
||||
,dlog)
|
||||
where
|
||||
|
||||
import Control.Monad (when)
|
||||
@ -305,6 +305,10 @@ ptraceAtWith level f
|
||||
-- in trace (s++":"++nlorspace++intercalate "\n" ls') 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.
|
||||
-- | Pretty-print a label and the showable value to the console, then return it.
|
||||
dbg0 :: Show a => String -> a -> a
|
||||
|
Loading…
Reference in New Issue
Block a user