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

Safe Haskell | Trustworthy
Language | Haskell2010

Control.Monad.Logger

Contents

- MonadLogger
- Re-export from fast-logger
- Helper transformers
- TH logging
- TH logging of showable values
- TH logging with source
- TH util
- Non-TH logging
- Non-TH logging with source
- Callstack logging
- utilities for defining your own loggers

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

- class Monad m => MonadLogger (m :: Type -> Type) where
  - monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> m ()
- class (MonadLogger m, MonadIO m) => MonadLoggerIO (m :: Type -> Type) where
  - askLoggerIO :: m (Loc -> LogSource -> LogLevel -> LogStr -> IO ())
- data LogLevel
  - = LevelDebug
  - | LevelInfo
  - | LevelWarn
  - | LevelError
  - | LevelOther Text
- type LogLine = (Loc, LogSource, LogLevel, LogStr)
- type LogSource = Text
- data LogStr
- class ToLogStr msg where
  - toLogStr :: msg -> LogStr
- fromLogStr :: LogStr -> ByteString
- newtype LoggingT (m :: Type -> Type) a = LoggingT {
  - runLoggingT :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> m a
  }
- runStderrLoggingT :: MonadIO m => LoggingT m a -> m a
- runStdoutLoggingT :: MonadIO m => LoggingT m a -> m a
- runChanLoggingT :: MonadIO m => Chan LogLine -> LoggingT m a -> m a
- runFileLoggingT :: MonadBaseControl IO m => FilePath -> LoggingT m a -> m a
- unChanLoggingT :: (MonadLogger m, MonadIO m) => Chan LogLine -> m void
- withChannelLogger :: forall (m :: Type -> Type) a. (MonadBaseControl IO m, MonadIO m) => Int -> LoggingT m a -> LoggingT m a
- filterLogger :: forall (m :: Type -> Type) a. (LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a
- newtype NoLoggingT (m :: Type -> Type) a = NoLoggingT {
  - runNoLoggingT :: m a
  }
- mapNoLoggingT :: (m a -> n b) -> NoLoggingT m a -> NoLoggingT n b
- newtype WriterLoggingT (m :: Type -> Type) a = WriterLoggingT {
  - unWriterLoggingT :: m (a, DList LogLine)
  }
- execWriterLoggingT :: Functor m => WriterLoggingT m a -> m [LogLine]
- runWriterLoggingT :: Functor m => WriterLoggingT m a -> m (a, [LogLine])
- mapLoggingT :: (m a -> n b) -> LoggingT m a -> LoggingT n b
- logDebug :: Q Exp
- logInfo :: Q Exp
- logWarn :: Q Exp
- logError :: Q Exp
- logOther :: Text -> Q Exp
- logDebugSH :: Q Exp
- logInfoSH :: Q Exp
- logWarnSH :: Q Exp
- logErrorSH :: Q Exp
- logOtherSH :: Text -> Q Exp
- logDebugS :: Q Exp
- logInfoS :: Q Exp
- logWarnS :: Q Exp
- logErrorS :: Q Exp
- logOtherS :: Q Exp
- liftLoc :: Loc -> Q Exp
- logDebugN :: MonadLogger m => Text -> m ()
- logInfoN :: MonadLogger m => Text -> m ()
- logWarnN :: MonadLogger m => Text -> m ()
- logErrorN :: MonadLogger m => Text -> m ()
- logOtherN :: MonadLogger m => LogLevel -> Text -> m ()
- logWithoutLoc :: (MonadLogger m, ToLogStr msg) => LogSource -> LogLevel -> msg -> m ()
- logDebugNS :: MonadLogger m => LogSource -> Text -> m ()
- logInfoNS :: MonadLogger m => LogSource -> Text -> m ()
- logWarnNS :: MonadLogger m => LogSource -> Text -> m ()
- logErrorNS :: MonadLogger m => LogSource -> Text -> m ()
- logOtherNS :: MonadLogger m => LogSource -> LogLevel -> Text -> m ()
- logDebugCS :: MonadLogger m => CallStack -> Text -> m ()
- logInfoCS :: MonadLogger m => CallStack -> Text -> m ()
- logWarnCS :: MonadLogger m => CallStack -> Text -> m ()
- logErrorCS :: MonadLogger m => CallStack -> Text -> m ()
- logOtherCS :: MonadLogger m => CallStack -> LogLevel -> Text -> m ()
- defaultLogStr :: Loc -> LogSource -> LogLevel -> LogStr -> LogStr
- data Loc = Loc {
  - loc_filename :: String
  - loc_package :: String
  - loc_module :: String
  - loc_start :: CharPos
  - loc_end :: CharPos
  }
- defaultLoc :: Loc
- defaultOutput :: Handle -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()

# MonadLogger

class Monad m => MonadLogger (m :: Type -> Type) where Source #

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

Minimal complete definition

Nothing

Methods

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

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

#### Instances

Instances details

MonadIO m => MonadLogger (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> LoggingT m () Source #
Monad m => MonadLogger (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> NoLoggingT m () Source #
Monad m => MonadLogger (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterLoggingT m () Source #
MonadLogger m => MonadLogger (ResourceT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ResourceT m () Source #
MonadLogger m => MonadLogger (MaybeT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> MaybeT m () Source #
MonadLogger m => MonadLogger (ExceptT e m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ExceptT e m () Source #
MonadLogger m => MonadLogger (IdentityT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> IdentityT m () Source #
MonadLogger m => MonadLogger (ReaderT r m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ReaderT r m () Source #
MonadLogger m => MonadLogger (StateT s m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> StateT s m () Source #
MonadLogger m => MonadLogger (StateT s m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> StateT s m () Source #
(MonadLogger m, Monoid w) => MonadLogger (WriterT w m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterT w m () Source #
(MonadLogger m, Monoid w) => MonadLogger (WriterT w m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterT w m () Source #
MonadLogger m => MonadLogger (ConduitM i o m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ConduitM i o m () Source #
MonadLogger m => MonadLogger (ContT r m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ContT r m () Source #
(MonadLogger m, Monoid w) => MonadLogger (RWST r w s m) Source # |
Instance details Defined in Control.Monad.Logger 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 # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> RWST r w s m () Source #
MonadLogger m => MonadLogger (Pipe l i o u m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> Pipe l i o u m () Source #

class (MonadLogger m, MonadIO m) => MonadLoggerIO (m :: Type -> Type) 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

Minimal complete definition

Nothing

Methods

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

Request the logging function itself.

Since: 0.3.10

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

#### Instances

Instances details

MonadIO m => MonadLoggerIO (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: LoggingT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadIO m => MonadLoggerIO (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: NoLoggingT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (ResourceT m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: ResourceT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (MaybeT m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: MaybeT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (ExceptT e m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: ExceptT e m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (IdentityT m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: IdentityT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (ReaderT r m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: ReaderT r m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (StateT s m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: StateT s m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (StateT s m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: StateT s m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
(MonadLoggerIO m, Monoid w) => MonadLoggerIO (WriterT w m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: WriterT w m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
(MonadLoggerIO m, Monoid w) => MonadLoggerIO (WriterT w m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: WriterT w m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (ConduitM i o m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: ConduitM i o m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (ContT r m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: ContT r m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
(MonadLoggerIO m, Monoid w) => MonadLoggerIO (RWST r w s m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: RWST r w s m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
(MonadLoggerIO m, Monoid w) => MonadLoggerIO (RWST r w s m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: RWST r w s m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadLoggerIO m => MonadLoggerIO (Pipe l i o u m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: Pipe l i o u m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #

data LogLevel Source #

Constructors

LevelDebug |
LevelInfo |
LevelWarn |
LevelError |
LevelOther Text |

#### Instances

Instances details

Read LogLevel Source # |
Instance details Defined in Control.Monad.Logger Methods readsPrec :: Int -> ReadS LogLevel Source # readList :: ReadS [LogLevel] Source # readPrec :: ReadPrec LogLevel Source # readListPrec :: ReadPrec [LogLevel] Source #
Show LogLevel Source # |
Instance details Defined in Control.Monad.Logger Methods showsPrec :: Int -> LogLevel -> ShowS Source # show :: LogLevel -> String Source # showList :: [LogLevel] -> ShowS Source #
Eq LogLevel Source # |
Instance details Defined in Control.Monad.Logger Methods (==) :: LogLevel -> LogLevel -> Bool Source # (/=) :: LogLevel -> LogLevel -> Bool Source #
Ord LogLevel Source # |
Instance details Defined in Control.Monad.Logger Methods compare :: LogLevel -> LogLevel -> Ordering Source # (<) :: LogLevel -> LogLevel -> Bool Source # (<=) :: LogLevel -> LogLevel -> Bool Source # (>) :: LogLevel -> LogLevel -> Bool Source # (>=) :: LogLevel -> LogLevel -> Bool Source # max :: LogLevel -> LogLevel -> LogLevel Source # min :: LogLevel -> LogLevel -> LogLevel Source #
Lift LogLevel Source # |
Instance details Defined in Control.Monad.Logger Methods lift :: Quote m => LogLevel -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => LogLevel -> Code m LogLevel Source #

type LogLine = (Loc, LogSource, LogLevel, LogStr) Source #

Since: 0.3.32

type LogSource = Text Source #

# Re-export from fast-logger

data LogStr Source #

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

#### Instances

Instances details

ToLogStr LogStr |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: LogStr -> LogStr Source #
Monoid LogStr |
Instance details Defined in System.Log.FastLogger.LogStr Methods mempty :: LogStr Source # mappend :: LogStr -> LogStr -> LogStr Source # mconcat :: [LogStr] -> LogStr Source #
Semigroup LogStr |
Instance details Defined in System.Log.FastLogger.LogStr Methods (<>) :: LogStr -> LogStr -> LogStr Source # sconcat :: NonEmpty LogStr -> LogStr Source # stimes :: Integral b => b -> LogStr -> LogStr Source #
IsString LogStr |
Instance details Defined in System.Log.FastLogger.LogStr Methods fromString :: String -> LogStr Source #
Show LogStr |
Instance details Defined in System.Log.FastLogger.LogStr Methods showsPrec :: Int -> LogStr -> ShowS Source # show :: LogStr -> String Source # showList :: [LogStr] -> ShowS Source #
Eq LogStr |
Instance details Defined in System.Log.FastLogger.LogStr Methods (==) :: LogStr -> LogStr -> Bool Source # (/=) :: LogStr -> LogStr -> Bool Source #

class ToLogStr msg where Source #

Types that can be converted to a `LogStr`. Instances for types from the `text` library use a UTF-8 encoding. Instances for numerical types use a decimal encoding.

Methods

toLogStr :: msg -> LogStr Source #

#### Instances

Instances details

ToLogStr Builder |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Builder -> LogStr Source #
ToLogStr ByteString |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: ByteString -> LogStr Source #
ToLogStr ByteString |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: ByteString -> LogStr Source #
ToLogStr ShortByteString |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: ShortByteString -> LogStr Source #
ToLogStr LogStr |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: LogStr -> LogStr Source #
ToLogStr Int16 | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Int16 -> LogStr Source #
ToLogStr Int32 | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Int32 -> LogStr Source #
ToLogStr Int64 | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Int64 -> LogStr Source #
ToLogStr Int8 | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Int8 -> LogStr Source #
ToLogStr Word16 | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Word16 -> LogStr Source #
ToLogStr Word32 | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Word32 -> LogStr Source #
ToLogStr Word64 | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Word64 -> LogStr Source #
ToLogStr Word8 | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Word8 -> LogStr Source #
ToLogStr Text |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Text -> LogStr Source #
ToLogStr Text |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Text -> LogStr Source #
ToLogStr Integer | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Integer -> LogStr Source #
ToLogStr String |
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: String -> LogStr Source #
ToLogStr Double | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Double -> LogStr Source #
ToLogStr Float | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Float -> LogStr Source #
ToLogStr Int | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Int -> LogStr Source #
ToLogStr Word | Since: fast-logger-2.4.14
Instance details Defined in System.Log.FastLogger.LogStr Methods toLogStr :: Word -> LogStr Source #

fromLogStr :: LogStr -> ByteString Source #

Converting `LogStr` to `ByteString`.

# Helper transformers

newtype LoggingT (m :: Type -> Type) a Source #

Monad transformer that adds a new logging function.

Since: 0.2.2

Constructors

LoggingT |

Fields

- runLoggingT :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> m a

#### Instances

Instances details

MonadTransControl LoggingT Source # |

Instance details

Defined in Control.Monad.Logger

Associated Types

type StT LoggingT a |
Instance details Defined in Control.Monad.Logger type StT LoggingT a = a

Methods

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

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

MonadTrans LoggingT Source # |
Instance details Defined in Control.Monad.Logger Methods lift :: Monad m => m a -> LoggingT m a Source #
MonadRWS r w s m => MonadRWS r w s (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger
MonadBaseControl b m => MonadBaseControl b (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftBaseWith :: (RunInBase (LoggingT m) b -> b a) -> LoggingT m a Source # restoreM :: StM (LoggingT m) a -> LoggingT m a Source #
MonadAccum w m => MonadAccum w (LoggingT m) Source # | Since: 0.3.41
Instance details Defined in Control.Monad.Logger Methods look :: LoggingT m w Source # add :: w -> LoggingT m () Source # accum :: (w -> (a, w)) -> LoggingT m a Source #
MonadError e m => MonadError e (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods throwError :: e -> LoggingT m a Source # catchError :: LoggingT m a -> (e -> LoggingT m a) -> LoggingT m a Source #
MonadReader r m => MonadReader r (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods ask :: LoggingT m r Source # local :: (r -> r) -> LoggingT m a -> LoggingT m a Source # reader :: (r -> a) -> LoggingT m a Source #
MonadState s m => MonadState s (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods get :: LoggingT m s Source # put :: s -> LoggingT m () Source # state :: (s -> (a, s)) -> LoggingT m a Source #
MonadWriter w m => MonadWriter w (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods writer :: (a, w) -> LoggingT m a Source # tell :: w -> LoggingT m () Source # listen :: LoggingT m a -> LoggingT m (a, w) Source # pass :: LoggingT m (a, w -> w) -> LoggingT m a Source #
MonadBase b m => MonadBase b (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftBase :: b α -> LoggingT m α Source #
MonadIO m => MonadIO (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftIO :: IO a -> LoggingT m a Source #
MonadActive m => MonadActive (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadActive :: LoggingT m Bool Source #
MonadCatch m => MonadCatch (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods catch :: (HasCallStack, Exception e) => LoggingT m a -> (e -> LoggingT m a) -> LoggingT m a Source #
MonadMask m => MonadMask (LoggingT m) Source # |

Instance details

Defined in Control.Monad.Logger

Methods

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

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

generalBracket :: HasCallStack => LoggingT m a -> (a -> ExitCase b -> LoggingT m c) -> (a -> LoggingT m b) -> LoggingT m (b, c) Source #

MonadThrow m => MonadThrow (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods throwM :: (HasCallStack, Exception e) => e -> LoggingT m a Source #
Alternative m => Alternative (LoggingT m) Source # | Since: 0.3.40
Instance details Defined in Control.Monad.Logger Methods empty :: LoggingT m a Source # (<|>) :: LoggingT m a -> LoggingT m a -> LoggingT m a Source # some :: LoggingT m a -> LoggingT m [a] Source # many :: LoggingT m a -> LoggingT m [a] Source #
Applicative m => Applicative (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods pure :: a -> LoggingT m a Source # (<*>) :: LoggingT m (a -> b) -> LoggingT m a -> LoggingT m b Source # liftA2 :: (a -> b -> c) -> LoggingT m a -> LoggingT m b -> LoggingT m c Source # (*>) :: LoggingT m a -> LoggingT m b -> LoggingT m b Source # (<*) :: LoggingT m a -> LoggingT m b -> LoggingT m a Source #
Functor m => Functor (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods fmap :: (a -> b) -> LoggingT m a -> LoggingT m b Source # (<$) :: a -> LoggingT m b -> LoggingT m a Source #
Monad m => Monad (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods (>>=) :: LoggingT m a -> (a -> LoggingT m b) -> LoggingT m b Source # (>>) :: LoggingT m a -> LoggingT m b -> LoggingT m b Source # return :: a -> LoggingT m a Source #
MonadFail m => MonadFail (LoggingT m) Source # | Since: 0.3.30
Instance details Defined in Control.Monad.Logger Methods fail :: String -> LoggingT m a Source #
MonadIO m => MonadLogger (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> LoggingT m () Source #
MonadIO m => MonadLoggerIO (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: LoggingT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadCont m => MonadCont (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods callCC :: ((a -> LoggingT m b) -> LoggingT m a) -> LoggingT m a Source #
MonadResource m => MonadResource (LoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftResourceT :: ResourceT IO a -> LoggingT m a Source #
MonadUnliftIO m => MonadUnliftIO (LoggingT m) Source # | Since: 0.3.26
Instance details Defined in Control.Monad.Logger Methods withRunInIO :: ((forall a. LoggingT m a -> IO a) -> IO b) -> LoggingT m b Source #
(Applicative m, Monoid a) => Monoid (LoggingT m a) Source # |
Instance details Defined in Control.Monad.Logger Methods mempty :: LoggingT m a Source # mappend :: LoggingT m a -> LoggingT m a -> LoggingT m a Source # mconcat :: [LoggingT m a] -> LoggingT m a Source #
(Applicative m, Semigroup a) => Semigroup (LoggingT m a) Source # |
Instance details Defined in Control.Monad.Logger Methods (<>) :: LoggingT m a -> LoggingT m a -> LoggingT m a Source # sconcat :: NonEmpty (LoggingT m a) -> LoggingT m a Source # stimes :: Integral b => b -> LoggingT m a -> LoggingT m a Source #
type StT LoggingT a Source # |
Instance details Defined in Control.Monad.Logger type StT LoggingT a = a
type StM (LoggingT m) a Source # |
Instance details Defined in Control.Monad.Logger 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

:: forall (m :: Type -> Type) a. (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 :: forall (m :: Type -> Type) a. (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 :: Type -> Type) a Source #

Monad transformer that disables logging.

Since: 0.2.4

Constructors

NoLoggingT |

Fields

- runNoLoggingT :: m a

#### Instances

Instances details

MonadTransControl NoLoggingT Source # |

Instance details

Defined in Control.Monad.Logger

Associated Types

type StT NoLoggingT a |
Instance details Defined in Control.Monad.Logger type StT NoLoggingT a = a

Methods

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

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

MonadTrans NoLoggingT Source # |
Instance details Defined in Control.Monad.Logger Methods lift :: Monad m => m a -> NoLoggingT m a Source #
MonadBaseControl b m => MonadBaseControl b (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftBaseWith :: (RunInBase (NoLoggingT m) b -> b a) -> NoLoggingT m a Source # restoreM :: StM (NoLoggingT m) a -> NoLoggingT m a Source #
MonadAccum w m => MonadAccum w (NoLoggingT m) Source # | Since: 0.3.41
Instance details Defined in Control.Monad.Logger Methods look :: NoLoggingT m w Source # add :: w -> NoLoggingT m () Source # accum :: (w -> (a, w)) -> NoLoggingT m a Source #
MonadError e m => MonadError e (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods throwError :: e -> NoLoggingT m a Source # catchError :: NoLoggingT m a -> (e -> NoLoggingT m a) -> NoLoggingT m a Source #
MonadReader r m => MonadReader r (NoLoggingT m) Source # | Since: 0.3.24
Instance details Defined in Control.Monad.Logger Methods ask :: NoLoggingT m r Source # local :: (r -> r) -> NoLoggingT m a -> NoLoggingT m a Source # reader :: (r -> a) -> NoLoggingT m a Source #
MonadState s m => MonadState s (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods get :: NoLoggingT m s Source # put :: s -> NoLoggingT m () Source # state :: (s -> (a, s)) -> NoLoggingT m a Source #
MonadWriter w m => MonadWriter w (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods writer :: (a, w) -> NoLoggingT m a Source # tell :: w -> NoLoggingT m () Source # listen :: NoLoggingT m a -> NoLoggingT m (a, w) Source # pass :: NoLoggingT m (a, w -> w) -> NoLoggingT m a Source #
MonadBase b m => MonadBase b (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftBase :: b α -> NoLoggingT m α Source #
MonadIO m => MonadIO (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftIO :: IO a -> NoLoggingT m a Source #
MonadActive m => MonadActive (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadActive :: NoLoggingT m Bool Source #
MonadCatch m => MonadCatch (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods catch :: (HasCallStack, Exception e) => NoLoggingT m a -> (e -> NoLoggingT m a) -> NoLoggingT m a Source #
MonadMask m => MonadMask (NoLoggingT m) Source # |

Instance details

Defined in Control.Monad.Logger

Methods

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

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

generalBracket :: HasCallStack => NoLoggingT m a -> (a -> ExitCase b -> NoLoggingT m c) -> (a -> NoLoggingT m b) -> NoLoggingT m (b, c) Source #

MonadThrow m => MonadThrow (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods throwM :: (HasCallStack, Exception e) => e -> NoLoggingT m a Source #
Alternative m => Alternative (NoLoggingT m) Source # | Since: 0.3.40
Instance details Defined in Control.Monad.Logger Methods empty :: NoLoggingT m a Source # (<|>) :: NoLoggingT m a -> NoLoggingT m a -> NoLoggingT m a Source # some :: NoLoggingT m a -> NoLoggingT m [a] Source # many :: NoLoggingT m a -> NoLoggingT m [a] Source #
Applicative m => Applicative (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods pure :: a -> NoLoggingT m a Source # (<*>) :: NoLoggingT m (a -> b) -> NoLoggingT m a -> NoLoggingT m b Source # liftA2 :: (a -> b -> c) -> NoLoggingT m a -> NoLoggingT m b -> NoLoggingT m c Source # (*>) :: NoLoggingT m a -> NoLoggingT m b -> NoLoggingT m b Source # (<*) :: NoLoggingT m a -> NoLoggingT m b -> NoLoggingT m a Source #
Functor m => Functor (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods fmap :: (a -> b) -> NoLoggingT m a -> NoLoggingT m b Source # (<$) :: a -> NoLoggingT m b -> NoLoggingT m a Source #
Monad m => Monad (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods (>>=) :: NoLoggingT m a -> (a -> NoLoggingT m b) -> NoLoggingT m b Source # (>>) :: NoLoggingT m a -> NoLoggingT m b -> NoLoggingT m b Source # return :: a -> NoLoggingT m a Source #
MonadFail m => MonadFail (NoLoggingT m) Source # | Since: 0.3.30
Instance details Defined in Control.Monad.Logger Methods fail :: String -> NoLoggingT m a Source #
Monad m => MonadLogger (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> NoLoggingT m () Source #
MonadIO m => MonadLoggerIO (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods askLoggerIO :: NoLoggingT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) Source #
MonadResource m => MonadResource (NoLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftResourceT :: ResourceT IO a -> NoLoggingT m a Source #
MonadUnliftIO m => MonadUnliftIO (NoLoggingT m) Source # | Since: 0.3.26
Instance details Defined in Control.Monad.Logger Methods withRunInIO :: ((forall a. NoLoggingT m a -> IO a) -> IO b) -> NoLoggingT m b Source #
(Applicative m, Monoid a) => Monoid (NoLoggingT m a) Source # |
Instance details Defined in Control.Monad.Logger Methods mempty :: NoLoggingT m a Source # mappend :: NoLoggingT m a -> NoLoggingT m a -> NoLoggingT m a Source # mconcat :: [NoLoggingT m a] -> NoLoggingT m a Source #
(Applicative m, Semigroup a) => Semigroup (NoLoggingT m a) Source # |
Instance details Defined in Control.Monad.Logger Methods (<>) :: NoLoggingT m a -> NoLoggingT m a -> NoLoggingT m a Source # sconcat :: NonEmpty (NoLoggingT m a) -> NoLoggingT m a Source # stimes :: Integral b => b -> NoLoggingT m a -> NoLoggingT m a Source #
type StT NoLoggingT a Source # |
Instance details Defined in Control.Monad.Logger type StT NoLoggingT a = a
type StM (NoLoggingT m) a Source # |
Instance details Defined in Control.Monad.Logger type StM (NoLoggingT m) a = StM m a

mapNoLoggingT :: (m a -> n b) -> NoLoggingT m a -> NoLoggingT n b Source #

Map the unwrapped computation using the given function.

Since: 0.3.29

newtype WriterLoggingT (m :: Type -> Type) a Source #

Since: 0.3.28

Constructors

WriterLoggingT |

Fields

- unWriterLoggingT :: m (a, DList LogLine)

#### Instances

Instances details

MonadTransControl WriterLoggingT Source # |

Instance details

Defined in Control.Monad.Logger

Associated Types

type StT WriterLoggingT a |
Instance details Defined in Control.Monad.Logger type StT WriterLoggingT a

Methods

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

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

MonadTrans WriterLoggingT Source # |
Instance details Defined in Control.Monad.Logger Methods lift :: Monad m => m a -> WriterLoggingT m a Source #
MonadBaseControl b m => MonadBaseControl b (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftBaseWith :: (RunInBase (WriterLoggingT m) b -> b a) -> WriterLoggingT m a Source # restoreM :: StM (WriterLoggingT m) a -> WriterLoggingT m a Source #
MonadBase b m => MonadBase b (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftBase :: b α -> WriterLoggingT m α Source #
MonadIO m => MonadIO (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods liftIO :: IO a -> WriterLoggingT m a Source #
MonadCatch m => MonadCatch (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods catch :: (HasCallStack, Exception e) => WriterLoggingT m a -> (e -> WriterLoggingT m a) -> WriterLoggingT m a Source #
MonadMask m => MonadMask (WriterLoggingT m) Source # |

Instance details

Defined in Control.Monad.Logger

Methods

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

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

generalBracket :: HasCallStack => WriterLoggingT m a -> (a -> ExitCase b -> WriterLoggingT m c) -> (a -> WriterLoggingT m b) -> WriterLoggingT m (b, c) Source #

MonadThrow m => MonadThrow (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods throwM :: (HasCallStack, Exception e) => e -> WriterLoggingT m a Source #
Applicative m => Applicative (WriterLoggingT m) Source # |

Instance details

Defined in Control.Monad.Logger

Methods

pure :: a -> WriterLoggingT m a Source #

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

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

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

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

Functor m => Functor (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods fmap :: (a -> b) -> WriterLoggingT m a -> WriterLoggingT m b Source # (<$) :: a -> WriterLoggingT m b -> WriterLoggingT m a Source #
Monad m => Monad (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods (>>=) :: WriterLoggingT m a -> (a -> WriterLoggingT m b) -> WriterLoggingT m b Source # (>>) :: WriterLoggingT m a -> WriterLoggingT m b -> WriterLoggingT m b Source # return :: a -> WriterLoggingT m a Source #
Monad m => MonadLogger (WriterLoggingT m) Source # |
Instance details Defined in Control.Monad.Logger Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterLoggingT m () Source #
(Applicative m, Monoid a) => Monoid (WriterLoggingT m a) Source # |
Instance details Defined in Control.Monad.Logger Methods mempty :: WriterLoggingT m a Source # mappend :: WriterLoggingT m a -> WriterLoggingT m a -> WriterLoggingT m a Source # mconcat :: [WriterLoggingT m a] -> WriterLoggingT m a Source #
(Applicative m, Semigroup a) => Semigroup (WriterLoggingT m a) Source # |
Instance details Defined in Control.Monad.Logger Methods (<>) :: WriterLoggingT m a -> WriterLoggingT m a -> WriterLoggingT m a Source # sconcat :: NonEmpty (WriterLoggingT m a) -> WriterLoggingT m a Source # stimes :: Integral b => b -> WriterLoggingT m a -> WriterLoggingT m a Source #
type StT WriterLoggingT a Source # |
Instance details Defined in Control.Monad.Logger type StT WriterLoggingT a
type StM (WriterLoggingT m) a Source # |
Instance details Defined in Control.Monad.Logger type StM (WriterLoggingT m) a = ComposeSt WriterLoggingT m a

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

mapLoggingT :: (m a -> n b) -> LoggingT m a -> LoggingT n b Source #

Map the unwrapped computation using the given function.

Since: 0.3.29

# 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"

logInfo :: Q Exp Source #

See `logDebug`

logWarn :: Q Exp Source #

See `logDebug`

logError :: Q Exp Source #

See `logDebug`

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

logInfoSH :: Q Exp Source #

See `logDebugSH`

logWarnSH :: Q Exp Source #

See `logDebugSH`

logErrorSH :: Q Exp Source #

See `logDebugSH`

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"

logInfoS :: Q Exp Source #

See `logDebugS`

logWarnS :: Q Exp Source #

See `logDebugS`

logErrorS :: Q Exp Source #

See `logDebugS`

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

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

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

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

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

logOtherN :: MonadLogger m => LogLevel -> 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 => LogSource -> Text -> m () Source #

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

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

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

logOtherNS :: MonadLogger m => LogSource -> LogLevel -> 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

defaultLogStr :: Loc -> LogSource -> LogLevel -> LogStr -> LogStr Source #

### Loc

When `monad-logger` is compiled with the `template_haskell` flag set to true (the default), the `Loc` below is a re-export from the `template-haskell` package. When the flag is false, the `Loc` below is a copy of that data structure defined in `monad-logger` itself.

If you are making a library that:

- Uses `monad-logger`
- Uses `Loc` in a type signature
- But doesn't need to depend on `template-haskell` for other reasons

You can import `Loc` directly from this package, instead of adding an dependency on `template-haskell` and importing from there. This allows users to compile your package in environments that don't support `template-haskell`.

data Loc Source #

Constructors

Loc |

Fields

- loc_filename :: String
- loc_package :: String
- loc_module :: String
- loc_start :: CharPos
- loc_end :: CharPos

#### Instances

Instances details

Data Loc |

Instance details

Defined in Language.Haskell.TH.Syntax

Methods

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

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

toConstr :: Loc -> Constr Source #

dataTypeOf :: Loc -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic Loc |

Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Loc |

Instance details

Defined in Language.Haskell.TH.Syntax

type Rep Loc = D1 ('MetaData "Loc" "Language.Haskell.TH.Syntax" "template-haskell" 'False) (C1 ('MetaCons "Loc" 'PrefixI 'True) ((S1 ('MetaSel ('Just "loc_filename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "loc_package") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "loc_module") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "loc_start") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CharPos) :*: S1 ('MetaSel ('Just "loc_end") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CharPos)))))

Methods

from :: Loc -> Rep Loc x Source #

to :: Rep Loc x -> Loc Source #

Show Loc |
Instance details Defined in Language.Haskell.TH.Syntax Methods showsPrec :: Int -> Loc -> ShowS Source # show :: Loc -> String Source # showList :: [Loc] -> ShowS Source #
Eq Loc |
Instance details Defined in Language.Haskell.TH.Syntax Methods (==) :: Loc -> Loc -> Bool Source # (/=) :: Loc -> Loc -> Bool Source #
Ord Loc |
Instance details Defined in Language.Haskell.TH.Syntax Methods compare :: Loc -> Loc -> Ordering Source # (<) :: Loc -> Loc -> Bool Source # (<=) :: Loc -> Loc -> Bool Source # (>) :: Loc -> Loc -> Bool Source # (>=) :: Loc -> Loc -> Bool Source # max :: Loc -> Loc -> Loc Source # min :: Loc -> Loc -> Loc Source #
Ppr Loc |
Instance details Defined in Language.Haskell.TH.Ppr Methods ppr :: Loc -> Doc Source # ppr_list :: [Loc] -> Doc Source #
type Rep Loc |

Instance details

Defined in Language.Haskell.TH.Syntax

type Rep Loc = D1 ('MetaData "Loc" "Language.Haskell.TH.Syntax" "template-haskell" 'False) (C1 ('MetaCons "Loc" 'PrefixI 'True) ((S1 ('MetaSel ('Just "loc_filename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "loc_package") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "loc_module") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "loc_start") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CharPos) :*: S1 ('MetaSel ('Just "loc_end") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CharPos)))))

defaultLoc :: Loc Source #

dummy location, used with `logWithoutLoc`

Since: 0.3.23

defaultOutput :: Handle -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

A default implementation of `monadLoggerLog` that accepts a file handle as the first argument.

This is used in the definition of `runStdoutLoggingT`:

    runStdoutLoggingT :: MonadIO m => LoggingT m a -> m a
    runStdoutLoggingT action =
        runLoggingT action (defaultOutput stdout)

Since: 0.3.36