tickLeisteServer/app/Logging.hs
2020-10-06 13:03:36 +02:00

25 lines
1 KiB
Haskell

module Logging(logError, logWarning, logDebug, logInfo) where
import Colog.Core.Severity
import qualified Colog as Log
import qualified Data.Text as T
--this module contains our own specialication of logger functionality,
--this is usually a bad idea, but as the apis force us to write
--plain IO actions anyway (run..., bracket, modifyMVar, ...) we
--we are forced to make logging an IO action and can't parametrize
--over the Monad. If we already do that we can write our own small
--helper to wrap our specialcase in IO.
logError :: Log.LogAction IO Log.Message -> T.Text -> IO ()
logError logAction = (Log.usingLoggerT logAction) . Log.logError
logWarning :: Log.LogAction IO Log.Message -> T.Text -> IO ()
logWarning logAction = (Log.usingLoggerT logAction) . Log.logWarning
logDebug :: Log.LogAction IO Log.Message -> T.Text -> IO ()
logDebug logAction = (Log.usingLoggerT logAction) . Log.logDebug
logInfo :: Log.LogAction IO Log.Message -> T.Text -> IO ()
logInfo logAction = (Log.usingLoggerT logAction) . Log.logInfo