monad-logger-0.3.28.1: A class of monads which can log messages.

Safe HaskellTrustworthy
LanguageHaskell98

Control.Monad.Logger

Contents

Description

This module provides the facilities needed for a decoupled logging system.

The MonadLogger class is implemented by monads that give access to a logging facility. If you're defining a custom monad, then you may define an instance of MonadLogger that routes the log messages to the appropriate place (e.g., that's what yesod-core's HandlerT does). Otherwise, you may use the LoggingT monad included in this module (see runStderrLoggingT). To simply discard log message, use NoLoggingT.

As a user of the logging facility, we provide you some convenient Template Haskell splices that use the MonadLogger class. They will record their source file and position, which is very helpful when debugging. See logDebug for more information.

Synopsis

MonadLogger

class Monad m => MonadLogger m where Source #

A Monad which has the ability to log messages in some manner.

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> m () Source #

monadLoggerLog :: (MonadLogger m', MonadTrans t, MonadLogger (t m'), ToLogStr msg, m ~ t m') => Loc -> LogSource -> LogLevel -> msg -> m () Source #

Instances

MonadLogger m => MonadLogger (MaybeT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> MaybeT m () Source #

MonadLogger m => MonadLogger (ListT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ListT m () Source #

MonadLogger m => MonadLogger (ResourceT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ResourceT m () Source #

MonadIO m => MonadLogger (LoggingT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> LoggingT m () Source #

Monad m => MonadLogger (WriterLoggingT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterLoggingT m () Source #

Monad m => MonadLogger (NoLoggingT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> NoLoggingT m () Source #

(MonadLogger m, Monoid w) => MonadLogger (WriterT w m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterT w m () Source #

(MonadLogger m, Monoid w) => MonadLogger (WriterT w m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterT w m () Source #

MonadLogger m => MonadLogger (StateT s m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> StateT s m () Source #

MonadLogger m => MonadLogger (StateT s m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> StateT s m () Source #

(MonadLogger m, Error e) => MonadLogger (ErrorT e m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ErrorT e m () Source #

MonadLogger m => MonadLogger (ExceptT e m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ExceptT e m () Source #

MonadLogger m => MonadLogger (IdentityT * m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> IdentityT * m () Source #

MonadLogger m => MonadLogger (ReaderT * r m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ReaderT * r m () Source #

MonadLogger m => MonadLogger (ConduitM i o m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ConduitM i o m () Source #

MonadLogger m => MonadLogger (ContT * r m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ContT * r m () Source #

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

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> RWST r w s m () Source #

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

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> RWST r w s m () Source #

MonadLogger m => MonadLogger (Pipe l i o u m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> Pipe l i o u m () Source #

class (MonadLogger m, MonadIO m) => MonadLoggerIO m where Source #

An extension of MonadLogger for the common case where the logging action is a simple IO action. The advantage of using this typeclass is that the logging function itself can be extracted as a first-class value, which can make it easier to manipulate monad transformer stacks, as an example.

Since: 0.3.10

Methods

askLoggerIO :: m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

Request the logging function itself.

Since: 0.3.10

askLoggerIO :: (MonadTrans t, MonadLoggerIO n, m ~ t n) => m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

Request the logging function itself.

Since: 0.3.10

Instances

MonadLoggerIO m => MonadLoggerIO (MaybeT m) Source # 

Methods

askLoggerIO :: MaybeT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (ListT m) Source # 

Methods

askLoggerIO :: ListT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (ResourceT m) Source # 

Methods

askLoggerIO :: ResourceT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadIO m => MonadLoggerIO (LoggingT m) Source # 

Methods

askLoggerIO :: LoggingT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadIO m => MonadLoggerIO (NoLoggingT m) Source # 
(MonadLoggerIO m, Monoid w) => MonadLoggerIO (WriterT w m) Source # 

Methods

askLoggerIO :: WriterT w m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

(MonadLoggerIO m, Monoid w) => MonadLoggerIO (WriterT w m) Source # 

Methods

askLoggerIO :: WriterT w m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (StateT s m) Source # 

Methods

askLoggerIO :: StateT s m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (StateT s m) Source # 

Methods

askLoggerIO :: StateT s m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

(MonadLoggerIO m, Error e) => MonadLoggerIO (ErrorT e m) Source # 

Methods

askLoggerIO :: ErrorT e m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (ExceptT e m) Source # 

Methods

askLoggerIO :: ExceptT e m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (IdentityT * m) Source # 

Methods

askLoggerIO :: IdentityT * m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (ReaderT * r m) Source # 

Methods

askLoggerIO :: ReaderT * r m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (ConduitM i o m) Source # 

Methods

askLoggerIO :: ConduitM i o m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (ContT * r m) Source # 

Methods

askLoggerIO :: ContT * r m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

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

Methods

askLoggerIO :: RWST r w s m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

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

Methods

askLoggerIO :: RWST r w s m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadLoggerIO m => MonadLoggerIO (Pipe l i o u m) Source # 

Methods

askLoggerIO :: Pipe l i o u m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

Re-export from fast-logger

data LogStr :: * #

Log message builder. Use (<>) to append two LogStr in O(1).

class ToLogStr msg where #

Minimal complete definition

toLogStr

Methods

toLogStr :: msg -> LogStr #

Helper transformers

newtype LoggingT m a Source #

Monad transformer that adds a new logging function.

Since: 0.2.2

Constructors

LoggingT 

Fields

Instances

MonadTrans LoggingT Source # 

Methods

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

MonadTransControl LoggingT Source # 

Associated Types

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

Methods

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

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

MonadRWS r w s m => MonadRWS r w s (LoggingT m) Source # 
MonadBaseControl b m => MonadBaseControl b (LoggingT m) Source # 

Associated Types

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

Methods

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

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

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

Methods

liftBase :: b α -> LoggingT m α #

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

Methods

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

tell :: w -> LoggingT m () #

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

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

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

Methods

get :: LoggingT m s #

put :: s -> LoggingT m () #

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

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

Methods

ask :: LoggingT m r #

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

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

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

Methods

throwError :: e -> LoggingT m a #

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

Monad m => Monad (LoggingT m) Source # 

Methods

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

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

return :: a -> LoggingT m a #

fail :: String -> LoggingT m a #

Functor m => Functor (LoggingT m) Source # 

Methods

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

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

Applicative m => Applicative (LoggingT m) Source # 

Methods

pure :: a -> LoggingT m a #

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

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

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

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

MonadIO m => MonadIO (LoggingT m) Source # 

Methods

liftIO :: IO a -> LoggingT m a #

MonadUnliftIO m => MonadUnliftIO (LoggingT m) Source #

Since: 0.3.26

Methods

askUnliftIO :: LoggingT m (UnliftIO (LoggingT m)) #

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

MonadActive m => MonadActive (LoggingT m) Source # 
MonadThrow m => MonadThrow (LoggingT m) Source # 

Methods

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

MonadCatch m => MonadCatch (LoggingT m) Source # 

Methods

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

MonadMask m => MonadMask (LoggingT m) Source # 

Methods

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

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

MonadCont m => MonadCont (LoggingT m) Source # 

Methods

callCC :: ((a -> LoggingT m b) -> LoggingT m a) -> LoggingT m a #

MonadResource m => MonadResource (LoggingT m) Source # 

Methods

liftResourceT :: ResourceT IO a -> LoggingT m a #

MonadIO m => MonadLoggerIO (LoggingT m) Source # 

Methods

askLoggerIO :: LoggingT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

MonadIO m => MonadLogger (LoggingT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> LoggingT m () Source #

type StT LoggingT a Source # 
type StT LoggingT a = a
type StM (LoggingT m) a Source # 
type StM (LoggingT m) a = StM m a

runStderrLoggingT :: MonadIO m => LoggingT m a -> m a Source #

Run a block using a MonadLogger instance which prints to stderr.

Since: 0.2.2

runStdoutLoggingT :: MonadIO m => LoggingT m a -> m a Source #

Run a block using a MonadLogger instance which prints to stdout.

Since: 0.2.2

runChanLoggingT :: MonadIO m => Chan LogLine -> LoggingT m a -> m a Source #

Run a block using a MonadLogger instance which writes tuples to an unbounded channel.

The tuples can be extracted (ie. in another thread) with unChanLoggingT or a custom extraction funtion, and written to a destination.

Since: 0.3.17

runFileLoggingT :: MonadBaseControl IO m => FilePath -> LoggingT m a -> m a Source #

Run a block using a MonadLogger instance which appends to the specified file.

Since: 0.3.22

unChanLoggingT :: (MonadLogger m, MonadIO m) => Chan LogLine -> m void Source #

Read logging tuples from an unbounded channel and log them into a MonadLoggerIO monad, forever.

For use in a dedicated thread with a channel fed by runChanLoggingT.

Since: 0.3.17

withChannelLogger Source #

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> Int

Number of messages to keep

-> LoggingT m a 
-> LoggingT m a 

Within the LoggingT monad, capture all log messages to a bounded channel of the indicated size, and only actually log them if there is an exception.

Since: 0.3.2

filterLogger :: (LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a Source #

Only log messages passing the given predicate function.

This can be a convenient way, for example, to ignore debug level messages.

Since: 0.3.13

newtype NoLoggingT m a Source #

Monad transformer that disables logging.

Since: 0.2.4

Constructors

NoLoggingT 

Fields

Instances

MonadTrans NoLoggingT Source # 

Methods

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

MonadTransControl NoLoggingT Source # 

Associated Types

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

Methods

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

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

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

Associated Types

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

Methods

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

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

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

Methods

liftBase :: b α -> NoLoggingT m α #

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

Methods

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

tell :: w -> NoLoggingT m () #

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

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

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

Methods

get :: NoLoggingT m s #

put :: s -> NoLoggingT m () #

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

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

Since: 0.3.24

Methods

ask :: NoLoggingT m r #

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

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

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

Methods

throwError :: e -> NoLoggingT m a #

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

Monad m => Monad (NoLoggingT m) Source # 

Methods

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

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

return :: a -> NoLoggingT m a #

fail :: String -> NoLoggingT m a #

Functor m => Functor (NoLoggingT m) Source # 

Methods

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

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

Applicative m => Applicative (NoLoggingT m) Source # 

Methods

pure :: a -> NoLoggingT m a #

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

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

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

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

MonadIO m => MonadIO (NoLoggingT m) Source # 

Methods

liftIO :: IO a -> NoLoggingT m a #

MonadUnliftIO m => MonadUnliftIO (NoLoggingT m) Source #

Since: 0.3.26

Methods

askUnliftIO :: NoLoggingT m (UnliftIO (NoLoggingT m)) #

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

MonadActive m => MonadActive (NoLoggingT m) Source # 
MonadThrow m => MonadThrow (NoLoggingT m) Source # 

Methods

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

MonadCatch m => MonadCatch (NoLoggingT m) Source # 

Methods

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

MonadMask m => MonadMask (NoLoggingT m) Source # 

Methods

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

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

MonadResource m => MonadResource (NoLoggingT m) Source # 
MonadIO m => MonadLoggerIO (NoLoggingT m) Source # 
Monad m => MonadLogger (NoLoggingT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> NoLoggingT m () Source #

type StT NoLoggingT a Source # 
type StT NoLoggingT a = a
type StM (NoLoggingT m) a Source # 
type StM (NoLoggingT m) a = StM m a

newtype WriterLoggingT m a Source #

Since: 0.3.28

Constructors

WriterLoggingT 

Fields

Instances

MonadTrans WriterLoggingT Source # 

Methods

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

MonadTransControl WriterLoggingT Source # 

Associated Types

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

Methods

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

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

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

Associated Types

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

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

Methods

liftBase :: b α -> WriterLoggingT m α #

Monad m => Monad (WriterLoggingT m) Source # 
Functor m => Functor (WriterLoggingT m) Source # 

Methods

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

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

Applicative m => Applicative (WriterLoggingT m) Source # 

Methods

pure :: a -> WriterLoggingT m a #

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

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

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

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

MonadIO m => MonadIO (WriterLoggingT m) Source # 

Methods

liftIO :: IO a -> WriterLoggingT m a #

MonadThrow m => MonadThrow (WriterLoggingT m) Source # 

Methods

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

MonadCatch m => MonadCatch (WriterLoggingT m) Source # 

Methods

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

MonadMask m => MonadMask (WriterLoggingT m) Source # 

Methods

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

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

Monad m => MonadLogger (WriterLoggingT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterLoggingT m () Source #

type StT WriterLoggingT a Source # 
type StM (WriterLoggingT m) a Source # 

execWriterLoggingT :: Functor m => WriterLoggingT m a -> m [LogLine] Source #

Run a block using a MonadLogger instance. Return logs in a list | @since 0.3.28

runWriterLoggingT :: Functor m => WriterLoggingT m a -> m (a, [LogLine]) Source #

Run a block using a MonadLogger instance. Return a value and logs in a list | @since 0.3.28

TH logging

logDebug :: Q Exp Source #

Generates a function that takes a Text and logs a LevelDebug message. Usage:

$(logDebug) "This is a debug log message"

logOther :: Text -> Q Exp Source #

Generates a function that takes a Text and logs a LevelOther message. Usage:

$(logOther "My new level") "This is a log message"

TH logging of showable values

logDebugSH :: Q Exp Source #

Generates a function that takes a 'Show a => a' and logs a LevelDebug message. Usage:

$(logDebugSH) (Just "This is a debug log message")

Since: 0.3.18

logOtherSH :: Text -> Q Exp Source #

Generates a function that takes a 'Show a => a' and logs a LevelOther message. Usage:

$(logOtherSH "My new level") "This is a log message"

TH logging with source

logDebugS :: Q Exp Source #

Generates a function that takes a LogSource and Text and logs a LevelDebug message. Usage:

$logDebugS "SomeSource" "This is a debug log message"

logOtherS :: Q Exp Source #

Generates a function that takes a LogSource, a level name and a Text and logs a LevelOther message. Usage:

$logOtherS "SomeSource" "My new level" "This is a log message"

TH util

liftLoc :: Loc -> Q Exp Source #

Lift a location into an Exp.

Since: 0.3.1

Non-TH logging

logInfoN :: MonadLogger m => Text -> m () Source #

logWarnN :: MonadLogger m => Text -> m () Source #

Non-TH logging with source

logWithoutLoc :: (MonadLogger m, ToLogStr msg) => LogSource -> LogLevel -> msg -> m () Source #

Since: 0.3.23

logDebugNS :: MonadLogger m => Text -> Text -> m () Source #

logInfoNS :: MonadLogger m => Text -> Text -> m () Source #

logWarnNS :: MonadLogger m => Text -> Text -> m () Source #

logErrorNS :: MonadLogger m => Text -> Text -> m () Source #

Callstack logging

logDebugCS :: MonadLogger m => CallStack -> Text -> m () Source #

Logs a message with location given by CallStack. See CallStack for more convenient functions for CallStack based logging.

Since: 0.3.19

logInfoCS :: MonadLogger m => CallStack -> Text -> m () Source #

See logDebugCS

Since: 0.3.19

logWarnCS :: MonadLogger m => CallStack -> Text -> m () Source #

See logDebugCS

Since: 0.3.19

logErrorCS :: MonadLogger m => CallStack -> Text -> m () Source #

See logDebugCS

Since: 0.3.19

logOtherCS :: MonadLogger m => CallStack -> LogLevel -> Text -> m () Source #

See logDebugCS

Since: 0.3.19

utilities for defining your own loggers

data Loc :: * #

Instances

Eq Loc 

Methods

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

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

Data Loc 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Loc -> c Loc #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Loc #

toConstr :: Loc -> Constr #

dataTypeOf :: Loc -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Loc) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Loc) #

gmapT :: (forall b. Data b => b -> b) -> Loc -> Loc #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r #

gmapQ :: (forall d. Data d => d -> u) -> Loc -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Loc -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Loc -> m Loc #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc #

Ord Loc 

Methods

compare :: Loc -> Loc -> Ordering #

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

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

(>) :: Loc -> Loc -> Bool #

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

max :: Loc -> Loc -> Loc #

min :: Loc -> Loc -> Loc #

Show Loc 

Methods

showsPrec :: Int -> Loc -> ShowS #

show :: Loc -> String #

showList :: [Loc] -> ShowS #

Generic Loc 

Associated Types

type Rep Loc :: * -> * #

Methods

from :: Loc -> Rep Loc x #

to :: Rep Loc x -> Loc #

type Rep Loc 

defaultLoc :: Loc Source #

dummy location, used with logWithoutLoc

Since: 0.3.23