summaryrefslogtreecommitdiffhomepage
path: root/Log.hs
diff options
context:
space:
mode:
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