diff options
Diffstat (limited to 'src/VeriFuzz/Sim/Internal.hs')
-rw-r--r-- | src/VeriFuzz/Sim/Internal.hs | 10 |
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 |