aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Sim/Internal.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@ymhg.org>2019-04-03 17:30:31 +0100
committerYann Herklotz <git@ymhg.org>2019-04-03 17:30:31 +0100
commit9b4ff9bf2a5356b0603fe46cc45f9724bfbef341 (patch)
tree0cc15fc577768653958757b5fc6326a03402db6a /src/VeriFuzz/Sim/Internal.hs
parent72a6f29c7b1357fbeca70097c84138c6cf6d5e2a (diff)
downloadverismith-9b4ff9bf2a5356b0603fe46cc45f9724bfbef341.tar.gz
verismith-9b4ff9bf2a5356b0603fe46cc45f9724bfbef341.zip
Fix to the logger
Diffstat (limited to 'src/VeriFuzz/Sim/Internal.hs')
-rw-r--r--src/VeriFuzz/Sim/Internal.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/VeriFuzz/Sim/Internal.hs b/src/VeriFuzz/Sim/Internal.hs
index e3082b7..062035c 100644
--- a/src/VeriFuzz/Sim/Internal.hs
+++ b/src/VeriFuzz/Sim/Internal.hs
@@ -23,10 +23,12 @@ module VeriFuzz.Sim.Internal
, noPrint
, echoP
, logger
+ , logger_
)
where
import Control.Lens
+import Control.Monad (void)
import Data.Bits (shiftL)
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
@@ -110,3 +112,11 @@ logger fp name = log_stderr_with (l "_log.stderr.txt")
where
l s t = appendFile (file s) (T.unpack t) >> appendFile (file s) "\n"
file s = T.unpack (toTextIgnore $ fp </> fromText name) <> s
+
+logger_ :: FilePath -> Text -> Sh a -> Sh ()
+logger_ fp name =
+ void . log_stderr_with (l "_log.stderr.txt") . log_stdout_with
+ (l "_log.txt")
+ where
+ l s t = appendFile (file s) (T.unpack t) >> appendFile (file s) "\n"
+ file s = T.unpack (toTextIgnore $ fp </> fromText name) <> s