summaryrefslogtreecommitdiffhomepage
path: root/Log.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-30 12:54:50 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-30 12:55:28 -0400
commit1bda1faf65c2ccf4e6a0dc349ddbc0f97b67b1da (patch)
tree17fdff934f71bc2fbb643bb3ed96e7da757e5bb5 /Log.hs
parent263b547ad43dff0e4948e860ac8d1cfa4f4cf0f1 (diff)
downloaddebug-me-1bda1faf65c2ccf4e6a0dc349ddbc0f97b67b1da.tar.gz
log remote logs to subdir
Diffstat (limited to 'Log.hs')
-rw-r--r--Log.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Log.hs b/Log.hs
index 7e414a1..6f6ce30 100644
--- a/Log.hs
+++ b/Log.hs
@@ -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