Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains implementation of most commonly used logging backends.
You can write your own backends, by implementing an instance of IsLogBackend
type class.
Synopsis
- data FastLoggerBackend
- data SyslogBackend
- data ChanLoggerBackend
- data ParallelBackend
- data NullBackend
- data Filtering b
- filtering :: IsLogBackend b => LogFilter -> LogBackendSettings b -> LogBackendSettings (Filtering b)
- excluding :: IsLogBackend b => LogFilter -> LogBackendSettings b -> LogBackendSettings (Filtering b)
- data family LogBackendSettings b
- defStdoutSettings :: LogBackendSettings FastLoggerBackend
- defStderrSettings :: LogBackendSettings FastLoggerBackend
- defFileSettings :: FilePath -> LogBackendSettings FastLoggerBackend
- defaultSyslogSettings :: LogBackendSettings SyslogBackend
- defaultSyslogFormat :: Format
Documentation
This module contains several implementation of logging backend. A backend is some kind of target, where your messages will go. Each backend has its own specific settings.
Backends provided are:
- Fast-logger backend. It allows to write messages to stdout, stderr or arbitrary file.
- Syslog backend.
- Chan backend.
- Null backend. This discards all messages. Can be used to disable logging.
There are also some backend combinators:
- Filtering - passes messages, that match specified filter, to underlying backend.
- FilteringM - similar to Filtering, but allows to change the filter in runtime.
- Parallel - writes messages to several backends in parallel.
- Dynamic - allows to change underlying backend or its settings in runtime.
data FastLoggerBackend Source #
Fast-logger logging backend.
Instances
IsLogBackend FastLoggerBackend Source # | |
Defined in System.Log.Heavy.Backends data LogBackendSettings FastLoggerBackend :: Type Source # makeLogger :: Logger FastLoggerBackend Source # initLogBackend :: LogBackendSettings FastLoggerBackend -> IO FastLoggerBackend Source # wouldWriteMessage :: FastLoggerBackend -> LogMessage -> IO Bool Source # cleanupLogBackend :: FastLoggerBackend -> IO () Source # withLoggingB :: (MonadBaseControl IO m, MonadIO m) => LogBackendSettings FastLoggerBackend -> (FastLoggerBackend -> m a) -> m a Source # | |
data LogBackendSettings FastLoggerBackend Source # | |
Defined in System.Log.Heavy.Backends |
data SyslogBackend Source #
Syslog logging backend.
Instances
IsLogBackend SyslogBackend Source # | |
Defined in System.Log.Heavy.Backends data LogBackendSettings SyslogBackend :: Type Source # makeLogger :: Logger SyslogBackend Source # initLogBackend :: LogBackendSettings SyslogBackend -> IO SyslogBackend Source # wouldWriteMessage :: SyslogBackend -> LogMessage -> IO Bool Source # cleanupLogBackend :: SyslogBackend -> IO () Source # withLoggingB :: (MonadBaseControl IO m, MonadIO m) => LogBackendSettings SyslogBackend -> (SyslogBackend -> m a) -> m a Source # | |
data LogBackendSettings SyslogBackend Source # | |
Defined in System.Log.Heavy.Backends |
data ChanLoggerBackend Source #
Logging backend which writes all messages to the Chan
Instances
IsLogBackend ChanLoggerBackend Source # | |
Defined in System.Log.Heavy.Backends data LogBackendSettings ChanLoggerBackend :: Type Source # makeLogger :: Logger ChanLoggerBackend Source # initLogBackend :: LogBackendSettings ChanLoggerBackend -> IO ChanLoggerBackend Source # wouldWriteMessage :: ChanLoggerBackend -> LogMessage -> IO Bool Source # cleanupLogBackend :: ChanLoggerBackend -> IO () Source # withLoggingB :: (MonadBaseControl IO m, MonadIO m) => LogBackendSettings ChanLoggerBackend -> (ChanLoggerBackend -> m a) -> m a Source # | |
data LogBackendSettings ChanLoggerBackend Source # | |
Defined in System.Log.Heavy.Backends |
data ParallelBackend Source #
Logging backend that writes log messages to several other backends in parallel.
Instances
IsLogBackend ParallelBackend Source # | |
Defined in System.Log.Heavy.Backends data LogBackendSettings ParallelBackend :: Type Source # makeLogger :: Logger ParallelBackend Source # initLogBackend :: LogBackendSettings ParallelBackend -> IO ParallelBackend Source # wouldWriteMessage :: ParallelBackend -> LogMessage -> IO Bool Source # cleanupLogBackend :: ParallelBackend -> IO () Source # withLoggingB :: (MonadBaseControl IO m, MonadIO m) => LogBackendSettings ParallelBackend -> (ParallelBackend -> m a) -> m a Source # | |
data LogBackendSettings ParallelBackend Source # | |
Defined in System.Log.Heavy.Backends |
data NullBackend Source #
Null logging backend, which discards all messages
(passes them to devnull
, if you wish).
This can be used to disable logging.
Instances
IsLogBackend NullBackend Source # | |
Defined in System.Log.Heavy.Backends data LogBackendSettings NullBackend :: Type Source # makeLogger :: Logger NullBackend Source # initLogBackend :: LogBackendSettings NullBackend -> IO NullBackend Source # wouldWriteMessage :: NullBackend -> LogMessage -> IO Bool Source # cleanupLogBackend :: NullBackend -> IO () Source # withLoggingB :: (MonadBaseControl IO m, MonadIO m) => LogBackendSettings NullBackend -> (NullBackend -> m a) -> m a Source # | |
data LogBackendSettings NullBackend Source # | |
Defined in System.Log.Heavy.Backends |
Messages filtering backend. This backend passes a message to underlying backend, if this message conforms to specified filter.
Instances
IsLogBackend b => IsLogBackend (Filtering b) Source # | |
Defined in System.Log.Heavy.Backends data LogBackendSettings (Filtering b) :: Type Source # makeLogger :: Logger (Filtering b) Source # initLogBackend :: LogBackendSettings (Filtering b) -> IO (Filtering b) Source # wouldWriteMessage :: Filtering b -> LogMessage -> IO Bool Source # cleanupLogBackend :: Filtering b -> IO () Source # withLoggingB :: (MonadBaseControl IO m, MonadIO m) => LogBackendSettings (Filtering b) -> (Filtering b -> m a) -> m a Source # | |
data LogBackendSettings (Filtering b) Source # | |
Defined in System.Log.Heavy.Backends |
filtering :: IsLogBackend b => LogFilter -> LogBackendSettings b -> LogBackendSettings (Filtering b) Source #
Specify filter as LogFilter
.
excluding :: IsLogBackend b => LogFilter -> LogBackendSettings b -> LogBackendSettings (Filtering b) Source #
Exclude messages by filter.
data family LogBackendSettings b Source #
Logging backend settings data type
Instances
data LogBackendSettings AnyLogBackend Source # | |
data LogBackendSettings DynamicBackend Source # | |
data LogBackendSettings NullBackend Source # | |
Defined in System.Log.Heavy.Backends | |
data LogBackendSettings ParallelBackend Source # | |
Defined in System.Log.Heavy.Backends | |
data LogBackendSettings ChanLoggerBackend Source # | |
Defined in System.Log.Heavy.Backends | |
data LogBackendSettings SyslogBackend Source # | |
Defined in System.Log.Heavy.Backends | |
data LogBackendSettings FastLoggerBackend Source # | |
Defined in System.Log.Heavy.Backends | |
data LogBackendSettings (FilteringM b) Source # | |
Defined in System.Log.Heavy.Backends.Dynamic data LogBackendSettings (FilteringM b) = FilteringM (MVar (LogMessage -> Bool)) (LogBackendSettings b) | |
data LogBackendSettings (Filtering b) Source # | |
Defined in System.Log.Heavy.Backends |
Default settings
defStdoutSettings :: LogBackendSettings FastLoggerBackend Source #
Default settings for fast-logger stdout output
defStderrSettings :: LogBackendSettings FastLoggerBackend Source #
Default settings for fast-logger stderr output
defFileSettings :: FilePath -> LogBackendSettings FastLoggerBackend Source #
Default settings for fast-logger file output. This implies log rotation when log file size reaches 10Mb.
defaultSyslogSettings :: LogBackendSettings SyslogBackend Source #
Default settings for syslog backend
defaultSyslogFormat :: Format Source #
Default log message format fof syslog backend:
[{level}] {source}: {message}