setLogging :: Bool -> IO ()
setLogging debug = do
    hSetBuffering stdout LineBuffering
    hSetBuffering stderr LineBuffering
    removeAllHandlers
    hd <- streamHandler stderr prio
    updateGlobalLogger logName (setLevel prio . setHandlers [hd])
  where
    prio = if debug then DEBUG else INFO
setLogging :: Bool -> IO ()
setLogging debug = do
    hSetBuffering stdout LineBuffering
    hSetBuffering stderr LineBuffering
    removeAllHandlers
    hd <- streamHandler stderr prio
    updateGlobalLogger logName (setLevel prio . setHandlers [hd])
  where
    prio = if debug then DEBUG else INFO
setLogging debug = do
    hSetBuffering stdout LineBuffering
    hSetBuffering stderr LineBuffering
    removeAllHandlers
    hd <- streamHandler stderr prio
    updateGlobalLogger logName (setLevel prio . setHandlers [hd])
  where
    prio = if debug then DEBUG else INFO