simple-log-0.9.11: Simple log for Haskell

Safe HaskellNone
LanguageHaskell2010

System.Log.Simple.Base

Synopsis

Documentation

data Level Source #

Level of message

Constructors

Trace 
Debug 
Info 
Warning 
Error 
Fatal 
Instances
Bounded Level Source # 
Instance details

Defined in System.Log.Simple.Base

Enum Level Source # 
Instance details

Defined in System.Log.Simple.Base

Eq Level Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

(==) :: Level -> Level -> Bool #

(/=) :: Level -> Level -> Bool #

Ord Level Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

compare :: Level -> Level -> Ordering #

(<) :: Level -> Level -> Bool #

(<=) :: Level -> Level -> Bool #

(>) :: Level -> Level -> Bool #

(>=) :: Level -> Level -> Bool #

max :: Level -> Level -> Level #

min :: Level -> Level -> Level #

Read Level Source # 
Instance details

Defined in System.Log.Simple.Base

Show Level Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

showsPrec :: Int -> Level -> ShowS #

show :: Level -> String #

showList :: [Level] -> ShowS #

Default Level Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

def :: Level #

Formattable Level Source # 
Instance details

Defined in System.Log.Simple.Base

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

Instances
Eq Component Source # 
Instance details

Defined in System.Log.Simple.Base

Ord Component Source # 
Instance details

Defined in System.Log.Simple.Base

Read Component Source # 
Instance details

Defined in System.Log.Simple.Base

Show Component Source # 
Instance details

Defined in System.Log.Simple.Base

IsString Component Source # 
Instance details

Defined in System.Log.Simple.Base

Semigroup Component Source # 
Instance details

Defined in System.Log.Simple.Base

Monoid Component Source # 
Instance details

Defined in System.Log.Simple.Base

NFData Component Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

rnf :: Component -> () #

Formattable Component Source # 
Instance details

Defined in System.Log.Simple.Base

newtype Scope Source #

Log scope, also stored in reverse order

Constructors

Scope 

Fields

Instances
Eq Scope Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

(==) :: Scope -> Scope -> Bool #

(/=) :: Scope -> Scope -> Bool #

Ord Scope Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

compare :: Scope -> Scope -> Ordering #

(<) :: Scope -> Scope -> Bool #

(<=) :: Scope -> Scope -> Bool #

(>) :: Scope -> Scope -> Bool #

(>=) :: Scope -> Scope -> Bool #

max :: Scope -> Scope -> Scope #

min :: Scope -> Scope -> Scope #

Read Scope Source # 
Instance details

Defined in System.Log.Simple.Base

Show Scope Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

showsPrec :: Int -> Scope -> ShowS #

show :: Scope -> String #

showList :: [Scope] -> ShowS #

IsString Scope Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

fromString :: String -> Scope #

Semigroup Scope Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

(<>) :: Scope -> Scope -> Scope #

sconcat :: NonEmpty Scope -> Scope #

stimes :: Integral b => b -> Scope -> Scope #

Monoid Scope Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

mempty :: Scope #

mappend :: Scope -> Scope -> Scope #

mconcat :: [Scope] -> Scope #

NFData Scope Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

rnf :: Scope -> () #

Formattable Scope Source # 
Instance details

Defined in System.Log.Simple.Base

data Message Source #

Log message

Instances
Read Message Source # 
Instance details

Defined in System.Log.Simple.Base

Show Message Source # 
Instance details

Defined in System.Log.Simple.Base

NFData Message Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

rnf :: Message -> () #

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

data LogConfig Source #

Constructors

LogConfig 
Instances
Show LogConfig Source # 
Instance details

Defined in System.Log.Simple.Base

Default LogConfig Source # 
Instance details

Defined in System.Log.Simple.Base

Methods

def :: LogConfig #

Ixed LogConfig Source # 
Instance details

Defined in System.Log.Simple.Base

At LogConfig Source # 
Instance details

Defined in System.Log.Simple.Base

type Index LogConfig Source # 
Instance details

Defined in System.Log.Simple.Base

type IxValue LogConfig Source # 
Instance details

Defined in System.Log.Simple.Base

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) Source # 
Instance details

Defined in System.Log.Simple.Monad

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