aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/Logger.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Internal/Logger.hs')
-rw-r--r--src/Internal/Logger.hs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Internal/Logger.hs b/src/Internal/Logger.hs
index f1960fb..cc52c7e 100644
--- a/src/Internal/Logger.hs
+++ b/src/Internal/Logger.hs
@@ -4,17 +4,13 @@ import XMonad
import qualified XMonad.Util.ExtensibleState as XS
import System.IO
+import Internal.NoPersist
+
data LoggerState =
LoggerState {
- logHandle :: Maybe Handle
+ logHandle :: Maybe (NoPersist Handle)
}
-instance Read LoggerState where
- readsPrec i s = map (\(_, s) -> (LoggerState Nothing, s)) (readsPrec i s :: [((), String)])
-
-instance Show LoggerState where
- show _ = show ()
-
instance ExtensionClass LoggerState where
initialValue = LoggerState Nothing
@@ -26,10 +22,10 @@ logs s = do
case handle' of
Nothing -> do
handle <- io $ openFile "/tmp/xmonad.log" AppendMode
- XS.put $ LoggerState (Just handle)
+ XS.put $ LoggerState $ Just $ NoPersist handle
return handle
- Just h -> return h
+ Just (NoPersist h) -> return h
io $ do
hPutStrLn handle s