simple-log-0.9.3: Simple log for Haskell

Safe HaskellNone
LanguageHaskell2010

System.Log.Simple.Base

Synopsis

Documentation

level :: Text -> Maybe Level Source #

Parse level

level_ :: Text -> Level Source #

Parse level, failing on invalid input

newtype Component Source #

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

Constructors

Component 

Fields

newtype Scope Source #

Log scope, also stored in reverse order

Constructors

Scope 

Fields

type Converter a = Message -> a Source #

type Consumer a = ContT () IO (a -> IO ()) Source #

Returns function which accepts consumed value

consumer :: (((a -> IO ()) -> IO ()) -> IO ()) -> Consumer a Source #

Make consumer

type LogHandler = Consumer Message Source #

Message handler

defCfg :: LogConfig Source #

Default log config — info level

logCfg :: [(Component, Level)] -> LogConfig Source #

Make log config by list of components and levels

componentCfg :: Component -> Lens' LogConfig (Maybe Level) Source #

Component config level lens

componentLevel :: LogConfig -> Component -> Level Source #

Get politics for specified component

data Log Source #

Log

Constructors

Log 

Fields

Instances

Monad m => MonadReader Log (LogT m) # 

Methods

ask :: LogT m Log #

local :: (Log -> Log) -> LogT m a -> LogT m a #

reader :: (Log -> a) -> LogT m a #

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

rootLog :: Log -> Log Source #

Get root log, i.e. just drop current component and scope

getLog :: Component -> Scope -> Log -> Log Source #

Get log for specified component and scope

subLog :: Component -> Scope -> Log -> Log Source #

Get sub-log

getLogConfig :: MonadIO m => Log -> m LogConfig Source #

Read log config

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

writeLog :: MonadIO m => Log -> Level -> Text -> m () Source #

Write message to log for current component and scope

stopLog :: MonadIO m => Log -> m () Source #

Wait log messages and stop log