Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Level
- level :: Text -> Maybe Level
- level_ :: Text -> Level
- newtype Component = Component {
- componentPath :: [Text]
- newtype Scope = Scope {}
- data Message = Message {}
- type Converter a = Message -> a
- type Consumer a = ContT () IO (a -> IO ())
- consumer :: (((a -> IO ()) -> IO ()) -> IO ()) -> Consumer a
- type LogHandler = Consumer Message
- handler :: Converter a -> Consumer a -> Consumer Message
- data LogConfig = LogConfig {}
- defCfg :: LogConfig
- logCfg :: [(Component, Level)] -> LogConfig
- componentCfg :: Component -> Lens' LogConfig (Maybe Level)
- componentLevel :: LogConfig -> Component -> Level
- data Log = Log {
- logComponent :: Component
- logScope :: Scope
- logPost :: Message -> IO ()
- logStop :: IO ()
- logConfig :: MVar LogConfig
- logHandlers :: MVar [LogHandler]
- logRestartHandlers :: IO ()
- newLog :: LogConfig -> [LogHandler] -> IO Log
- rootLog :: Log -> Log
- getLog :: Component -> Scope -> Log -> Log
- subLog :: Component -> Scope -> Log -> Log
- getLogConfig :: MonadIO m => Log -> m LogConfig
- updateLogConfig :: MonadIO m => Log -> (LogConfig -> LogConfig) -> m LogConfig
- updateLogHandlers :: MonadIO m => Log -> ([LogHandler] -> [LogHandler]) -> m ()
- writeLog :: MonadIO m => Log -> Level -> Text -> m ()
- stopLog :: MonadIO m => Log -> m ()
Documentation
Level of message
Component — each one have separate log scopes and can have different politics Child component's root politics inherits its parent root politics Component name parts stored in reverse order
Component | |
|
Log scope, also stored in reverse order
Log message
type LogHandler = Consumer Message Source #
Message handler
logCfg :: [(Component, Level)] -> LogConfig Source #
Make log config by list of components and levels
Log
Log | |
|
Monad m => MonadReader Log (LogT m) # | |
newLog :: LogConfig -> [LogHandler] -> IO Log Source #
Create log, returns root logger for root component
Messages from distinct threads and components are splitted in several chans, where they are processed, and then messages combined back and sent to log-thread
updateLogConfig :: MonadIO m => Log -> (LogConfig -> LogConfig) -> m LogConfig Source #
Modify log config
updateLogHandlers :: MonadIO m => Log -> ([LogHandler] -> [LogHandler]) -> m () Source #
Update log handlers, this restarts handlers thread