module System.Log.Handler(
LogHandler(..)
) where
import System.Log
import System.Log.Formatter
class LogHandler a where
setLevel :: a -> Priority -> a
getLevel :: a -> Priority
setFormatter :: a -> LogFormatter a -> a
getFormatter :: a -> LogFormatter a
getFormatter a
_ = LogFormatter a
forall a. LogFormatter a
nullFormatter
handle :: a -> LogRecord -> String-> IO ()
handle a
h (Priority
pri, String
msg) String
logname =
if Priority
pri Priority -> Priority -> Bool
forall a. Ord a => a -> a -> Bool
>= (a -> Priority
forall a. LogHandler a => a -> Priority
getLevel a
h)
then do String
formattedMsg <- (a -> LogFormatter a
forall a. LogHandler a => a -> LogFormatter a
getFormatter a
h) a
h (Priority
pri,String
msg) String
logname
a -> LogRecord -> String -> IO ()
forall a. LogHandler a => a -> LogRecord -> String -> IO ()
emit a
h (Priority
pri, String
formattedMsg) String
logname
else () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
emit :: a -> LogRecord -> String -> IO ()
close :: a -> IO ()