summaryrefslogtreecommitdiffhomepage
path: root/Log.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Log.hs')
-rw-r--r--Log.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/Log.hs b/Log.hs
index cfbffea..ac250a1 100644
--- a/Log.hs
+++ b/Log.hs
@@ -7,12 +7,12 @@ import Hash
import Memory
import JSON
import SessionID
+import DotDir
import Data.Char
import Data.Time.Clock.POSIX
import qualified Data.ByteString.Lazy as L
import System.IO
-import System.Posix
import System.Directory
import System.FilePath
import Control.Exception
@@ -55,16 +55,14 @@ type Timestamp = POSIXTime
type Logger = AnyMessage -> IO ()
logDir :: IO FilePath
-logDir = do
- home <- homeDirectory <$> (getUserEntryForID =<< getEffectiveUserID)
- return $ home </> ".debug-me" </> "log"
+logDir = (</> "log") <$> dotDir
withSessionLogger :: SessionID -> (Logger -> IO a) -> IO a
withSessionLogger sessionid a = bracket setup cleanup go
where
setup = do
dir <- logDir
- createDirectoryIfMissing True dir
+ createDirectoryIfMissing False dir
let logfile = sessionLogFile dir sessionid
putStrLn $ "** debug-me is logging to " ++ logfile
return logfile