diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-30 12:54:50 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-30 12:55:28 -0400 |
commit | 1bda1faf65c2ccf4e6a0dc349ddbc0f97b67b1da (patch) | |
tree | 17fdff934f71bc2fbb643bb3ed96e7da757e5bb5 /Log.hs | |
parent | 263b547ad43dff0e4948e860ac8d1cfa4f4cf0f1 (diff) | |
download | debug-me-1bda1faf65c2ccf4e6a0dc349ddbc0f97b67b1da.tar.gz |
log remote logs to subdir
Diffstat (limited to 'Log.hs')
-rw-r--r-- | Log.hs | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -57,11 +57,12 @@ type Logger = AnyMessage -> IO () logDir :: IO FilePath logDir = (</> "log") <$> dotDir -withSessionLogger :: SessionID -> (Logger -> IO a) -> IO a -withSessionLogger sessionid a = bracket setup cleanup go +withSessionLogger :: (Maybe FilePath) -> SessionID -> (Logger -> IO a) -> IO a +withSessionLogger subdir sessionid a = bracket setup cleanup go where setup = do - dir <- logDir + basedir <- logDir + let dir = maybe basedir (basedir </>) subdir createDirectoryIfMissing False dir return $ sessionLogFile dir sessionid cleanup logfile = putStrLn $ "** debug-me session was logged to " ++ logfile |