{-# LANGUAGE RecordWildCards #-}
module Logging.Manager
( Manager(..)
, initialize
, terminate
) where
import Data.List (nub)
import Data.Map.Lazy (Map, elems)
import Data.Time.LocalTime
import Logging.Class.Handler
import Logging.Sink
data Manager = Manager { root :: Sink
, sinks :: Map String Sink
, timezone :: TimeZone
, disabled :: Bool
, catchUncaughtException :: Bool
}
{-# DEPRECATED catchUncaughtException "Will be removed" #-}
initialize :: Manager -> IO ()
initialize Manager{..} = mapM_ open $
nub $ concat [ handlers | Sink{..} <- (root : (elems sinks)) ]
terminate :: Manager -> IO ()
terminate Manager{..} = mapM_ close $
nub $ concat [ handlers | Sink{..} <- (root : (elems sinks)) ]