log-warper-1.1.4: Flexible, configurable, monadic and pretty logging

Safe HaskellNone
LanguageHaskell2010

System.Wlog.LoggerNameBox

Contents

Description

This module contains type classes for loggers that have LoggerName.

Synopsis

Remove boilerplater

class HasLoggerName m where Source #

This type class exists to remove boilerplate logging by adding the logger's name to the context in each module.

TODO: replace current methods with Lens?

Minimal complete definition

getLoggerName, modifyLoggerName

Methods

getLoggerName :: m LoggerName Source #

Extract logger name from context

modifyLoggerName :: (LoggerName -> LoggerName) -> m a -> m a Source #

Change logger name in context

Instances

HasLoggerName Identity Source # 
Monad m => HasLoggerName (LoggerNameBox m) Source # 
Monad m => HasLoggerName (NamedPureLogger m) Source # 
(HasLoggerName m, Monad m) => HasLoggerName (PureLogger m) Source # 
(Monoid w, Monad m, HasLoggerName m) => HasLoggerName (WriterT w m) Source # 
(Monad m, HasLoggerName m) => HasLoggerName (StateT a m) Source # 
(Monad m, HasLoggerName m) => HasLoggerName (StateT a m) Source # 
(Monad m, HasLoggerName m) => HasLoggerName (ExceptT e m) Source # 
(Monad m, HasLoggerName m) => HasLoggerName (ReaderT * a m) Source # 
(Monad m, HasLoggerName m) => HasLoggerName (ContT * r m) Source # 
(Monad m, HasLoggerName m, Monoid w) => HasLoggerName (RWST r w s m) Source # 

Methods

getLoggerName :: RWST r w s m LoggerName Source #

modifyLoggerName :: (LoggerName -> LoggerName) -> RWST r w s m a -> RWST r w s m a Source #

(Monad m, HasLoggerName m, Monoid w) => HasLoggerName (RWST r w s m) Source # 

Methods

getLoggerName :: RWST r w s m LoggerName Source #

modifyLoggerName :: (LoggerName -> LoggerName) -> RWST r w s m a -> RWST r w s m a Source #

newtype LoggerNameBox m a Source #

Default implementation of WithNamedLogger.

Instances

MonadTrans LoggerNameBox Source # 

Methods

lift :: Monad m => m a -> LoggerNameBox m a #

MonadState s m => MonadState s (LoggerNameBox m) Source # 

Methods

get :: LoggerNameBox m s #

put :: s -> LoggerNameBox m () #

state :: (s -> (a, s)) -> LoggerNameBox m a #

MonadReader r m => MonadReader r (LoggerNameBox m) Source # 

Methods

ask :: LoggerNameBox m r #

local :: (r -> r) -> LoggerNameBox m a -> LoggerNameBox m a #

reader :: (r -> a) -> LoggerNameBox m a #

MonadError e m => MonadError e (LoggerNameBox m) Source # 

Methods

throwError :: e -> LoggerNameBox m a #

catchError :: LoggerNameBox m a -> (e -> LoggerNameBox m a) -> LoggerNameBox m a #

MonadBase b m => MonadBase b (LoggerNameBox m) Source # 

Methods

liftBase :: b α -> LoggerNameBox m α #

MonadBaseControl b m => MonadBaseControl b (LoggerNameBox m) Source # 

Associated Types

type StM (LoggerNameBox m :: * -> *) a :: * #

Monad m => Monad (LoggerNameBox m) Source # 

Methods

(>>=) :: LoggerNameBox m a -> (a -> LoggerNameBox m b) -> LoggerNameBox m b #

(>>) :: LoggerNameBox m a -> LoggerNameBox m b -> LoggerNameBox m b #

return :: a -> LoggerNameBox m a #

fail :: String -> LoggerNameBox m a #

Functor m => Functor (LoggerNameBox m) Source # 

Methods

fmap :: (a -> b) -> LoggerNameBox m a -> LoggerNameBox m b #

(<$) :: a -> LoggerNameBox m b -> LoggerNameBox m a #

MonadFix m => MonadFix (LoggerNameBox m) Source # 

Methods

mfix :: (a -> LoggerNameBox m a) -> LoggerNameBox m a #

Applicative m => Applicative (LoggerNameBox m) Source # 

Methods

pure :: a -> LoggerNameBox m a #

(<*>) :: LoggerNameBox m (a -> b) -> LoggerNameBox m a -> LoggerNameBox m b #

(*>) :: LoggerNameBox m a -> LoggerNameBox m b -> LoggerNameBox m b #

(<*) :: LoggerNameBox m a -> LoggerNameBox m b -> LoggerNameBox m a #

MonadIO m => MonadIO (LoggerNameBox m) Source # 

Methods

liftIO :: IO a -> LoggerNameBox m a #

MonadThrow m => MonadThrow (LoggerNameBox m) Source # 

Methods

throwM :: Exception e => e -> LoggerNameBox m a #

MonadCatch m => MonadCatch (LoggerNameBox m) Source # 

Methods

catch :: Exception e => LoggerNameBox m a -> (e -> LoggerNameBox m a) -> LoggerNameBox m a #

MonadMask m => MonadMask (LoggerNameBox m) Source # 

Methods

mask :: ((forall a. LoggerNameBox m a -> LoggerNameBox m a) -> LoggerNameBox m b) -> LoggerNameBox m b #

uninterruptibleMask :: ((forall a. LoggerNameBox m a -> LoggerNameBox m a) -> LoggerNameBox m b) -> LoggerNameBox m b #

Monad m => HasLoggerName (LoggerNameBox m) Source # 
CanLog m => CanLog (LoggerNameBox m) Source # 
MFunctor * LoggerNameBox Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> t m b -> t n b #

type StM (LoggerNameBox m) a Source # 

setLoggerName :: HasLoggerName m => LoggerName -> m a -> m a Source #

Set logger name in context.

usingLoggerName :: LoggerName -> LoggerNameBox m a -> m a Source #

Runs a LoggerNameBox with specified initial LoggerName.