diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-28 17:00:17 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-28 17:00:17 -0400 |
commit | e683f156b7eb8e761c254704538914d86f309801 (patch) | |
tree | e239803c2f775cbb914a8c7db44189974728781a /Log.hs | |
parent | e833b89e2a1a1c2acbc0eb8bed1760ef0e50f3c5 (diff) | |
download | debug-me-e683f156b7eb8e761c254704538914d86f309801.tar.gz |
control window and chatting
Works!
Diffstat (limited to 'Log.hs')
-rw-r--r-- | Log.hs | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -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 |