log-base-0.7.1.1: Structured logging solution (base package)

Safe HaskellNone
LanguageHaskell2010

Log.Monad

Description

The LogT monad transformer for adding logging capabilities to any monad.

Synopsis

Documentation

data Logger Source #

An object used for communication with a logger thread that outputs LogMessages using e.g. PostgreSQL, Elasticsearch or stdout (depending on the back-end chosen).

Instances

data LoggerEnv Source #

The state that every LogT carries around.

Constructors

LoggerEnv 

Fields

newtype LogT m a Source #

Monad transformer that adds logging capabilities to the underlying monad.

Constructors

LogT 

Fields

Instances

MonadTrans LogT Source # 

Methods

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

MonadTransControl LogT Source # 

Associated Types

type StT (LogT :: (* -> *) -> * -> *) a :: * #

Methods

liftWith :: Monad m => (Run LogT -> m a) -> LogT m a #

restoreT :: Monad m => m (StT LogT a) -> LogT m a #

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

Methods

liftBase :: b α -> LogT m α #

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

Associated Types

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

Methods

liftBaseWith :: (RunInBase (LogT m) b -> b a) -> LogT m a #

restoreM :: StM (LogT m) a -> LogT m a #

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

Methods

throwError :: e -> LogT m a #

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

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

Methods

ask :: LogT m r #

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

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

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

Methods

get :: LogT m s #

put :: s -> LogT m () #

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

MonadWriter w m => MonadWriter w (LogT m) Source # 

Methods

writer :: (a, w) -> LogT m a #

tell :: w -> LogT m () #

listen :: LogT m a -> LogT m (a, w) #

pass :: LogT m (a, w -> w) -> LogT m a #

Monad m => Monad (LogT m) Source # 

Methods

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

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

return :: a -> LogT m a #

fail :: String -> LogT m a #

Functor m => Functor (LogT m) Source # 

Methods

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

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

Applicative m => Applicative (LogT m) Source # 

Methods

pure :: a -> LogT m a #

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

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

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

Alternative m => Alternative (LogT m) Source # 

Methods

empty :: LogT m a #

(<|>) :: LogT m a -> LogT m a -> LogT m a #

some :: LogT m a -> LogT m [a] #

many :: LogT m a -> LogT m [a] #

MonadPlus m => MonadPlus (LogT m) Source # 

Methods

mzero :: LogT m a #

mplus :: LogT m a -> LogT m a -> LogT m a #

MonadIO m => MonadIO (LogT m) Source # 

Methods

liftIO :: IO a -> LogT m a #

MonadThrow m => MonadThrow (LogT m) Source # 

Methods

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

MonadCatch m => MonadCatch (LogT m) Source # 

Methods

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

MonadMask m => MonadMask (LogT m) Source # 

Methods

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

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

(MonadBase IO m, MonadTime m) => MonadLog (LogT m) Source # 

Methods

logMessage :: UTCTime -> LogLevel -> Text -> Value -> LogT m () Source #

localData :: [Pair] -> LogT m a -> LogT m a Source #

localDomain :: Text -> LogT m a -> LogT m a Source #

type StT LogT m Source # 
type StT LogT m = StT InnerLogT m
type StM (LogT m) a Source # 
type StM (LogT m) a = ComposeSt LogT m a

runLogT Source #

Arguments

:: Text

Application component name to use.

-> Logger

The logging back-end to use.

-> LogT m a

The LogT computation to run.

-> m a 

Run a LogT computation.

Note that in the case of asynchronous/bulk loggers runLogT doesn't guarantee that all messages are actually written to the log once it finishes. Use withPGLogger or withElasticSearchLogger for that.

mapLogT :: (m a -> n b) -> LogT m a -> LogT n b Source #

Transform the computation inside a LogT.