Safe Haskell | None |
---|---|
Language | Haskell2010 |
Type class that add ability to log messages. Supports pure and IO logging.
- class Monad m => CanLog m where
- type WithLogger m = (CanLog m, HasLoggerName m)
- logDebug :: WithLogger m => Text -> m ()
- logError :: WithLogger m => Text -> m ()
- logInfo :: WithLogger m => Text -> m ()
- logNotice :: WithLogger m => Text -> m ()
- logWarning :: WithLogger m => Text -> m ()
- logMessage :: WithLogger m => Severity -> Text -> m ()
Documentation
class Monad m => CanLog m where Source #
Instances of this class should explain how they add messages to their log.
dispatchMessage :: LoggerName -> Severity -> Text -> m () Source #
dispatchMessage :: (MonadTrans t, t n ~ m, CanLog n) => LoggerName -> Severity -> Text -> m () Source #
CanLog IO Source # | |
CanLog m => CanLog (LoggerNameBox m) Source # | |
Monad m => CanLog (NamedPureLogger m) Source # | |
Monad m => CanLog (PureLogger m) Source # | |
CanLog m => CanLog (StateT s m) Source # | |
CanLog m => CanLog (StateT s m) Source # | |
CanLog m => CanLog (ExceptT s m) Source # | |
CanLog m => CanLog (ReaderT * r m) Source # | |
(CanLog m, Monoid w) => CanLog (RWST r w s m) Source # | |
(CanLog m, Monoid w) => CanLog (RWST r w s m) Source # | |
type WithLogger m = (CanLog m, HasLoggerName m) Source #
Type alias for constraints CanLog
and HasLoggerName
.
We need two different type classes to support more flexible interface
but in practice we usually use them both.
Logging functions
logDebug :: WithLogger m => Text -> m () Source #
Shortcut for logMessage
to use according severity.
logError :: WithLogger m => Text -> m () Source #
Shortcut for logMessage
to use according severity.
logInfo :: WithLogger m => Text -> m () Source #
Shortcut for logMessage
to use according severity.
logNotice :: WithLogger m => Text -> m () Source #
Shortcut for logMessage
to use according severity.
logWarning :: WithLogger m => Text -> m () Source #
Shortcut for logMessage
to use according severity.
logMessage :: WithLogger m => Severity -> Text -> m () Source #
Logs message with specified severity using logger name in context.