Copyright | (c) Serokell 2016 |
---|---|
License | GPL-3 (see the file LICENSE) |
Maintainer | Serokell <hi@serokell.io> |
Stability | experimental |
Portability | POSIX, GHC |
Safe Haskell | None |
Language | Haskell2010 |
Logging functionality. This module is wrapper over hslogger, which allows to keep logger name in monadic context.
- data Severity
- initTerminalLogging :: MonadIO m => Bool -> Maybe Severity -> m ()
- releaseAllHandlers :: MonadIO m => m ()
- setSeverity :: MonadIO m => LoggerName -> Severity -> m ()
- setSeverityMaybe :: MonadIO m => LoggerName -> Maybe Severity -> m ()
Documentation
Severity is level of log message importance. It uniquely determines which messages to print.
initTerminalLogging :: MonadIO m => Bool -> Maybe Severity -> m () Source #
This function initializes global logging system for terminal output. At high level, it sets severity which will be used by all loggers by default, sets default formatters and sets custom severity for given loggers (if any).
NOTE: you probably don't want to use this function.
Consider setupLogging
.
On a lower level it does the following:
1. Removes default handler from root logger, sets two handlers such that:
1.1. All messages are printed to stdout.
1.2. Moreover messages with at least Error
severity are
printed to stderr.
2. Sets given Severity to root logger, so that it will be used by
descendant loggers by default.
3. Applies setSeverity
to given loggers. It can be done later using
setSeverity
directly.
releaseAllHandlers :: MonadIO m => m () Source #
Lifted alias to removeAllHandlers
.
setSeverity :: MonadIO m => LoggerName -> Severity -> m () Source #
Set severity for given logger. By default parent's severity is used.
setSeverityMaybe :: MonadIO m => LoggerName -> Maybe Severity -> m () Source #
Set or clear severity.