1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
{-# LANGUAGE DeriveDataTypeable #-}
module Network.IRC.Bot.Log where
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as C
import Data.Data
data LogLevel
= Debug
| Normal
| Important
deriving (Eq, Ord, Read, Show, Data, Typeable)
type Logger = LogLevel -> ByteString -> IO ()
stdoutLogger :: LogLevel -> Logger
stdoutLogger minLvl msgLvl msg
| msgLvl >= minLvl = C.putStrLn msg -- assumes ascii, which is wrong(?)
| otherwise = return ()
nullLogger :: Logger
nullLogger _ _ = return ()
|