Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module incldues logging backend combinators that allow to change underlying backend or it's settings in runtime.
Synopsis
- data DynamicBackend
- data DynamicBackendHandle
- newDynamicBackendHandle :: LoggingSettings -> IO DynamicBackendHandle
- updateDynamicBackendSettings :: DynamicBackendHandle -> LoggingSettings -> IO ()
- data family LogBackendSettings b
- data FilteringM b
- filteringM :: IsLogBackend b => LogFilter -> LogBackendSettings b -> IO (LogBackendSettings (FilteringM b))
- excludingM :: IsLogBackend b => LogFilter -> LogBackendSettings b -> IO (LogBackendSettings (FilteringM b))
Dynamic backend
data DynamicBackend Source #
Dynamic logging backend allows to change logging backend or it's settings in runtime. When it sees new backend settings, it deinitializes old backend and initializes new one.
How to use it:
- Before creating
DynamicSettings
, you have to select some initialLoggingSettings
and createDynamicBackendHandle
with it. - When you decide that you want to use new backend settings, call
updateDynamicBackendSettings
on existingDynamicBackendHandle
.DynamicBackend
will use new settings for the next logging function call. - It is responsibility of caller code to do not change backends too frequently; for example, if you are checking your config file for updates of logging settings each 10s, you have to check that settings actually changed since last time.
It is possible to create one instance of DynamicBackendHandle
and pass it
to multiple threads.
Instances
IsLogBackend DynamicBackend Source # | |
Defined in System.Log.Heavy.Backends.Dynamic data LogBackendSettings DynamicBackend :: Type Source # makeLogger :: Logger DynamicBackend Source # initLogBackend :: LogBackendSettings DynamicBackend -> IO DynamicBackend Source # wouldWriteMessage :: DynamicBackend -> LogMessage -> IO Bool Source # cleanupLogBackend :: DynamicBackend -> IO () Source # withLoggingB :: (MonadBaseControl IO m, MonadIO m) => LogBackendSettings DynamicBackend -> (DynamicBackend -> m a) -> m a Source # | |
data LogBackendSettings DynamicBackend Source # | |
data DynamicBackendHandle Source #
Abstract handle, that is used to control DynamicBackend
.
newDynamicBackendHandle Source #
:: LoggingSettings | Initial logging settings. This can be changed later with |
-> IO DynamicBackendHandle |
Create an instance of DynamicBackendHandle
.
updateDynamicBackendSettings Source #
:: DynamicBackendHandle | Handle of |
-> LoggingSettings | New logging settings. |
-> IO () |
Update settings of DynamicBackend
, which was created by provided handle.
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 |
Dynamic filtering
data FilteringM b Source #
Filtering backend with mutable filter.
Instances
IsLogBackend b => IsLogBackend (FilteringM b) Source # | |
Defined in System.Log.Heavy.Backends.Dynamic data LogBackendSettings (FilteringM b) :: Type Source # makeLogger :: Logger (FilteringM b) Source # initLogBackend :: LogBackendSettings (FilteringM b) -> IO (FilteringM b) Source # wouldWriteMessage :: FilteringM b -> LogMessage -> IO Bool Source # cleanupLogBackend :: FilteringM b -> IO () Source # withLoggingB :: (MonadBaseControl IO m, MonadIO m) => LogBackendSettings (FilteringM b) -> (FilteringM b -> m a) -> m a Source # | |
data LogBackendSettings (FilteringM b) Source # | |
Defined in System.Log.Heavy.Backends.Dynamic data LogBackendSettings (FilteringM b) = FilteringM (MVar (LogMessage -> Bool)) (LogBackendSettings b) |
filteringM :: IsLogBackend b => LogFilter -> LogBackendSettings b -> IO (LogBackendSettings (FilteringM b)) Source #
Specify filter as LogFilter
. This filter can be changed later.
excludingM :: IsLogBackend b => LogFilter -> LogBackendSettings b -> IO (LogBackendSettings (FilteringM b)) Source #
Exclude messages by filter. This filter can be changed later.