Skip to content

Instantly share code, notes, and snippets.


k-bx/Seq.hs Secret

Last active Aug 29, 2015
What would you like to do?
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Control.Monad (replicateM, void)
import Prelude hiding (log)
import System.Log.Formatter
import System.Log.Handler (setFormatter)
import System.Log.Handler.Simple
import System.Log.Logger
import System.Timeout (timeout)
main :: IO ()
main = do
void (replicateM 2000 logger)
logger :: IO ()
logger = tm $ do
debugM "" (concat (replicate 1024 "ooooo"))
tm f = do
res <- timeout (200000) f
case res of
Just _ -> return ()
Nothing -> debugM "" "Timeout while logging"
logFilePath :: String
logFilePath = "log/timeoutbug.log"
setUpLogging :: IO ()
setUpLogging = do
h <- fileHandler logFilePath DEBUG >>= \lh -> return $
setFormatter lh (simpleLogFormatter
"[$time : $loggername : $prio] $msg")
updateGlobalLogger rootLoggerName (addHandler h)
updateGlobalLogger rootLoggerName (setLevel DEBUG)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.