log-base-0.8.0.0: 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
Semigroup Logger Source # 
Instance details

Defined in Log.Internal.Logger

Monoid Logger Source #

Composition of Logger objects.

Instance details

Defined in Log.Internal.Logger

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

Defined in Log.Monad

Methods

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

MonadTransControl LogT Source # 
Instance details

Defined in Log.Monad

Associated Types

type StT LogT a :: Type #

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

Defined in Log.Monad

Methods

liftBase :: b α -> LogT m α #

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

Defined in Log.Monad

Associated Types

type StM (LogT m) a :: Type #

Methods

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

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

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

Defined in Log.Monad

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 #

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

Defined in Log.Monad

Methods

get :: LogT m s #

put :: s -> LogT m () #

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

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

Defined in Log.Monad

Methods

ask :: LogT m r #

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

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

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

Defined in Log.Monad

Methods

throwError :: e -> LogT m a #

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

Monad m => Monad (LogT m) Source # 
Instance details

Defined in Log.Monad

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

Defined in Log.Monad

Methods

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

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

Applicative m => Applicative (LogT m) Source # 
Instance details

Defined in Log.Monad

Methods

pure :: a -> LogT m a #

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

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

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

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

Alternative m => Alternative (LogT m) Source # 
Instance details

Defined in Log.Monad

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

Defined in Log.Monad

Methods

mzero :: LogT m a #

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

MonadIO m => MonadIO (LogT m) Source # 
Instance details

Defined in Log.Monad

Methods

liftIO :: IO a -> LogT m a #

MonadThrow m => MonadThrow (LogT m) Source # 
Instance details

Defined in Log.Monad

Methods

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

MonadCatch m => MonadCatch (LogT m) Source # 
Instance details

Defined in Log.Monad

Methods

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

MonadMask m => MonadMask (LogT m) Source # 
Instance details

Defined in Log.Monad

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 #

generalBracket :: LogT m a -> (a -> ExitCase b -> LogT m c) -> (a -> LogT m b) -> LogT m (b, c) #

MonadUnliftIO m => MonadUnliftIO (LogT m) Source # 
Instance details

Defined in Log.Monad

Methods

askUnliftIO :: LogT m (UnliftIO (LogT m)) #

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

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

Defined in Log.Monad

MFunctor LogT Source #
hoist = mapLogT

Since: 0.7.2

Instance details

Defined in Log.Monad

Methods

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

type StT LogT m Source # 
Instance details

Defined in Log.Monad

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

Defined in Log.Monad

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.

logMessageIO :: LoggerEnv -> UTCTime -> LogLevel -> Text -> Value -> IO () Source #

Base implementation of logMessage for use with a specific LoggerEnv. Useful for reimplementation of MonadLog instance.

getLoggerIO :: MonadLog m => m (UTCTime -> LogLevel -> Text -> Value -> IO ()) Source #

Return an IO action that logs messages using the current MonadLog context. Useful for interfacing with libraries such as aws or amazonka that accept logging callbacks operating in IO.