monad-logger-aeson-0.4.1.3: JSON logging using monad-logger interface
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Logger.Aeson

Synopsis

Synopsis

monad-logger-aeson provides structured JSON logging using monad-logger's interface. Specifically, it is intended to be a (largely) drop-in replacement for monad-logger's Control.Monad.Logger.CallStack module.

In brief, this program:

{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE OverloadedStrings #-}
module Main
  ( main
  ) where

import Control.Monad.Logger.Aeson

doStuff :: (MonadLogger m) => Int -> m ()
doStuff x = do
  logDebug $ "Doing stuff" :# ["x" .= x]

main :: IO ()
main = do
  runStdoutLoggingT do
    doStuff 42
    logInfo "Done"

Would produce this output (formatted for readability here with jq):

{
  "time": "2022-05-15T20:52:15.5559417Z",
  "level": "debug",
  "location": {
    "package": "main",
    "module": "Main",
    "file": "app/readme-example.hs",
    "line": 11,
    "char": 3
  },
  "message": {
    "text": "Doing stuff",
    "meta": {
      "x": 42
    }
  }
}
{
  "time": "2022-05-15T20:52:15.5560448Z",
  "level": "info",
  "location": {
    "package": "main",
    "module": "Main",
    "file": "app/readme-example.hs",
    "line": 17,
    "char": 5
  },
  "message": {
    "text": "Done"
  }
}

For additional detail on the library, please see the remainder of these Haddocks and the following external resources:

Types

data Message Source #

A Message captures a textual component and a metadata component. The metadata component is a list of SeriesElem to support tacking on arbitrary structured data to a log message.

With the OverloadedStrings extension enabled, Message values can be constructed without metadata fairly conveniently, just as if we were using Text directly:

logDebug "Some log message without metadata"

Metadata may be included in a Message via the :# constructor:

logDebug $ "Some log message with metadata" :#
  [ "bloorp" .= (42 :: Int)
  , "bonk" .= ("abc" :: Text)
  ]

The mnemonic for the :# constructor is that the # symbol is sometimes referred to as a hash, a JSON object can be thought of as a hash map, and so with :# (and enough squinting), we are cons-ing a textual message onto a JSON object. Yes, this mnemonic isn't well-typed, but hopefully it still helps!

Since: 0.1.0.0

Constructors

Text :# [SeriesElem] infixr 5 

Instances

Instances details
IsString Message Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

Methods

fromString :: String -> Message #

ToLogStr Message Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

Methods

toLogStr :: Message -> LogStr #

data SeriesElem Source #

A single key-value pair, where the value is encoded JSON. This is a more restricted version of Series: a SeriesElem is intended to encapsulate exactly one key-value pair, whereas a Series encapsulates zero or more key-value pairs. SeriesElem values can be created via (.=) from aeson.

While a SeriesElem most often will map to a single pair, note that a Semigroup instance is available for performance's sake. The Semigroup instance is useful when multiple pairs are grouped together and then shared across multiple logging calls. In that case, the cost of combining the pairs in the group must only be paid once.

Since: 0.3.0.0

Instances

Instances details
Semigroup SeriesElem Source #

Since: 0.3.1.0

Instance details

Defined in Control.Monad.Logger.Aeson.Internal

KeyValue Encoding SeriesElem Source #

Since: 0.3.0.0

Instance details

Defined in Control.Monad.Logger.Aeson.Internal

Methods

(.=) :: ToJSON v => Key -> v -> SeriesElem #

explicitToField :: (v -> Encoding) -> Key -> v -> SeriesElem #

data LoggedMessage Source #

This type is the Haskell representation of each JSON log message produced by this library.

While we never interact with this type directly when logging messages with monad-logger-aeson, we may wish to use this type if we are parsing/processing log files generated by this library.

Since: 0.1.0.0

Instances

Instances details
FromJSON LoggedMessage Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

ToJSON LoggedMessage Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

Generic LoggedMessage Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

Associated Types

type Rep LoggedMessage :: Type -> Type #

Show LoggedMessage Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

Eq LoggedMessage Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

Ord LoggedMessage Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

type Rep LoggedMessage Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

type Rep LoggedMessage = D1 ('MetaData "LoggedMessage" "Control.Monad.Logger.Aeson.Internal" "monad-logger-aeson-0.4.1.3-HgR54Smd1pLFhl48pa1fO4" 'False) (C1 ('MetaCons "LoggedMessage" 'PrefixI 'True) ((S1 ('MetaSel ('Just "loggedMessageTimestamp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: (S1 ('MetaSel ('Just "loggedMessageLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LogLevel) :*: S1 ('MetaSel ('Just "loggedMessageLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Loc)))) :*: ((S1 ('MetaSel ('Just "loggedMessageLogSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe LogSource)) :*: S1 ('MetaSel ('Just "loggedMessageThreadContext") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (KeyMap Value))) :*: (S1 ('MetaSel ('Just "loggedMessageText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "loggedMessageMeta") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (KeyMap Value))))))

Logging functions

Implicit call stack, no LogSource

logDebug :: (HasCallStack, MonadLogger m) => Message -> m () Source #

Logs a Message with the location provided by an implicit CallStack.

Since: 0.1.0.0

logInfo :: (HasCallStack, MonadLogger m) => Message -> m () Source #

See logDebug

Since: 0.1.0.0

logWarn :: (HasCallStack, MonadLogger m) => Message -> m () Source #

See logDebug

Since: 0.1.0.0

logError :: (HasCallStack, MonadLogger m) => Message -> m () Source #

See logDebug

Since: 0.1.0.0

logOther :: (HasCallStack, MonadLogger m) => LogLevel -> Message -> m () Source #

See logDebug

Since: 0.1.0.0

Explicit call stack, no LogSource

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

Logs a Message with location given by CallStack.

Since: 0.1.0.0

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

See logDebugCS

Since: 0.1.0.0

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

See logDebugCS

Since: 0.1.0.0

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

See logDebugCS

Since: 0.1.0.0

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

See logDebugCS

Since: 0.1.0.0

Implicit call stack, with LogSource

logDebugNS :: (HasCallStack, MonadLogger m) => LogSource -> Message -> m () Source #

See logDebugCS

Since: 0.1.0.0

logInfoNS :: (HasCallStack, MonadLogger m) => LogSource -> Message -> m () Source #

See logDebugNS

Since: 0.1.0.0

logWarnNS :: (HasCallStack, MonadLogger m) => LogSource -> Message -> m () Source #

See logDebugNS

Since: 0.1.0.0

logErrorNS :: (HasCallStack, MonadLogger m) => LogSource -> Message -> m () Source #

See logDebugNS

Since: 0.1.0.0

logOtherNS :: (HasCallStack, MonadLogger m) => LogSource -> LogLevel -> Message -> m () Source #

See logDebugNS

Since: 0.1.0.0

Convenience aliases

logDebugN :: (HasCallStack, MonadLogger m) => Message -> m () Source #

See logDebug.

This is an alias for logDebug and is provided mainly for symmetry with monad-logger.

Since: 0.4.0.0

logInfoN :: (HasCallStack, MonadLogger m) => Message -> m () Source #

See logDebugN

Since: 0.4.0.0

logWarnN :: (HasCallStack, MonadLogger m) => Message -> m () Source #

See logDebugN

Since: 0.4.0.0

logErrorN :: (HasCallStack, MonadLogger m) => Message -> m () Source #

See logDebugN

Since: 0.4.0.0

logOtherN :: (HasCallStack, MonadLogger m) => LogLevel -> Message -> m () Source #

See logDebugN

Since: 0.4.0.0

Thread context

withThreadContext :: (MonadIO m, MonadMask m) => [Pair] -> m a -> m a Source #

This function lets us register structured, contextual info for the duration of the provided action. All messages logged within the provided action will automatically include this contextual info. This function is thread-safe, as the contextual info is scoped to the calling thread only.

This function is additive: if we nest calls to it, each nested call will add to the existing thread context. In the case of overlapping keys, the nested call's Pair value(s) will win. Whenever the inner action completes, the thread context is rolled back to its value set in the enclosing action.

If we wish to include the existing thread context from one thread in another thread, we must register the thread context explicitly on that other thread. myThreadContext can be leveraged in this case.

Registering thread context for messages can be useful in many scenarios. One particularly apt scenario is in wai middlewares. We can generate an ID for each incoming request then include it in the thread context. Now all messages subsequently logged from our endpoint handler will automatically include that request ID:

import Control.Monad.Logger.Aeson ((.=), withThreadContext)
import Network.Wai (Middleware)
import qualified Data.UUID.V4 as UUID

addRequestId :: Middleware
addRequestId app = \request sendResponse -> do
  uuid <- UUID.nextRandom
  withThreadContext ["requestId" .= uuid] do
    app request sendResponse

If we're coming from a Java background, it may be helpful for us to draw parallels between this function and log4j2's ThreadContext (or perhaps log4j's MDC). They all enable the same thing: setting some thread-local info that will be automatically pulled into each logged message.

Since: 0.1.0.0

myThreadContext :: (MonadIO m, MonadThrow m) => m (KeyMap Value) Source #

This function lets us retrieve the calling thread's thread context. For more detail, we can consult the docs for withThreadContext.

Note that even though the type signature lists MonadThrow as a required constraint, the library guarantees that myThreadContext will never throw.

Since: 0.1.0.0

LoggingT runners

runFileLoggingT :: (MonadIO m, MonadMask m) => FilePath -> LoggingT m a -> m a Source #

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

Note that this differs from the monad-logger version in its constraints. We use the exceptions package's MonadMask here for bracketing, rather than monad-control.

Since: 0.1.0.0

runHandleLoggingT :: (LogLevel -> Handle) -> LoggingT m a -> m a Source #

Run a block using a MonadLogger instance which prints to a Handle determined by the log message's LogLevel.

A common use case for this function is to log warn/error messages to stderr and debug/info messages to stdout in CLIs/tools (see defaultHandleFromLevel).

Since: 0.1.0.0

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

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

Since: 0.1.0.0

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

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

Since: 0.1.0.0

runFastLoggingT :: LoggerSet -> LoggingT m a -> m a Source #

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

Since: 0.1.0.0

Utilities for defining our own loggers

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

A default implementation of the action that backs the monadLoggerLog function. It accepts a file handle as the first argument and will log incoming LogStr values wrapped in the JSON structure prescribed by this library.

This is used in the definition of runStdoutLoggingT and runStderrLoggingT:

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

We can instead use defaultOutputWith if we need more control of the output.

Since: 0.1.0.0

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

An implementation of the action that backs the monadLoggerLog function, where the Handle destination for each log message is determined by the log message's LogLevel. This function will log incoming LogStr values wrapped in the JSON structure prescribed by this library.

This is used in the definition of runHandleLoggingT:

runHandleLoggingT :: (LogLevel -> Handle) -> LoggingT m a -> m a
runHandleLoggingT = flip runLoggingT . handleOutput

Since: 0.1.0.0

fastLoggerOutput :: LoggerSet -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

An implementation of the action that backs the monadLoggerLog function, where log messages are written to a provided LoggerSet. This function will log incoming LogStr values wrapped in the JSON structure prescribed by this library.

This is used in the definition of runFastLoggingT:

runFastLoggingT :: LoggerSet -> LoggingT m a -> m a
runFastLoggingT loggerSet = flip runLoggingT (fastLoggerOutput loggerSet)

Since: 0.1.0.0

defaultOutputWith :: OutputOptions -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

This function is a lower-level helper for implementing the action that backs the monadLoggerLog function.

We should generally prefer defaultOutput over this function, but this function is available if we do need more control over our output.

Since: 0.1.0.0

defaultOutputOptions :: (LogLevel -> ByteString -> IO ()) -> OutputOptions Source #

Given an output action for log messages, this function will produce the default recommended OutputOptions.

Specific options can be overriden via record update syntax using outputIncludeThreadId, outputBaseThreadContext, and friends.

Since: 0.1.0.0

data OutputOptions Source #

OutputOptions is for use with defaultOutputWith and enables us to configure the JSON output produced by this library.

We can get a hold of a value of this type via defaultOutputOptions.

Since: 0.1.0.0

outputIncludeThreadId :: OutputOptions -> Bool Source #

Controls whether or not the thread ID is included in each log message's thread context.

Default: False

Since: 0.1.0.0

outputBaseThreadContext :: OutputOptions -> [Pair] Source #

Allows for setting a "base" thread context, i.e. a set of Pair that will always be present in log messages.

If we subsequently use withThreadContext to register some thread context for our messages, if any of the keys in those Pair values overlap with the "base" thread context, then the overlapped Pair values in the "base" thread context will be overridden for the duration of the action provided to withThreadContext.

Default: mempty

Since: 0.1.0.0

defaultHandleFromLevel :: (Text -> Handle) -> LogLevel -> Handle Source #

This function maps the possible LogLevel values to Handle values. Specifically, LevelDebug and LevelInfo map to stdout, while LevelWarn and LevelError map to stderr. The function is most useful for CLIs/tools (see runHandleLoggingT).

The input function discriminating Text is used to determine the Handle mapping for LevelOther. For example, if we wish for all LevelOther messages to be logged to stderr, we can supply (const stderr) as the value for this input function.

Since: 0.1.0.0

Re-exports from aeson

(.=) :: (KeyValue e kv, ToJSON v) => Key -> v -> kv infixr 8 #

Re-exports from monad-logger

class ToLogStr msg where #

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 #

Instances

Instances details
ToLogStr Int16

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Int16 -> LogStr #

ToLogStr Int32

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Int32 -> LogStr #

ToLogStr Int64

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Int64 -> LogStr #

ToLogStr Int8

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Int8 -> LogStr #

ToLogStr Word16

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Word16 -> LogStr #

ToLogStr Word32

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Word32 -> LogStr #

ToLogStr Word64

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Word64 -> LogStr #

ToLogStr Word8

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Word8 -> LogStr #

ToLogStr Builder 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Builder -> LogStr #

ToLogStr ByteString 
Instance details

Defined in System.Log.FastLogger.LogStr

ToLogStr ByteString 
Instance details

Defined in System.Log.FastLogger.LogStr

ToLogStr ShortByteString 
Instance details

Defined in System.Log.FastLogger.LogStr

ToLogStr LogStr 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: LogStr -> LogStr #

ToLogStr Message Source # 
Instance details

Defined in Control.Monad.Logger.Aeson.Internal

Methods

toLogStr :: Message -> LogStr #

ToLogStr Text 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Text -> LogStr #

ToLogStr Text 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Text -> LogStr #

ToLogStr String 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: String -> LogStr #

ToLogStr Integer

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Integer -> LogStr #

ToLogStr Double

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Double -> LogStr #

ToLogStr Float

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Float -> LogStr #

ToLogStr Int

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Int -> LogStr #

ToLogStr Word

Since: fast-logger-2.4.14

Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: Word -> LogStr #

data LogStr #

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

Instances

Instances details
IsString LogStr 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

fromString :: String -> LogStr #

Monoid LogStr 
Instance details

Defined in System.Log.FastLogger.LogStr

Semigroup LogStr 
Instance details

Defined in System.Log.FastLogger.LogStr

Show LogStr 
Instance details

Defined in System.Log.FastLogger.LogStr

ToLogStr LogStr 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

toLogStr :: LogStr -> LogStr #

Eq LogStr 
Instance details

Defined in System.Log.FastLogger.LogStr

Methods

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

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

data Loc #

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 #

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 :: forall r r'. (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 #

Generic Loc 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Loc :: Type -> Type #

Methods

from :: Loc -> Rep Loc x #

to :: Rep Loc x -> Loc #

Show Loc 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

showsPrec :: Int -> Loc -> ShowS #

show :: Loc -> String #

showList :: [Loc] -> ShowS #

Eq Loc 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

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

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

Ord Loc 
Instance details

Defined in Language.Haskell.TH.Syntax

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 #

type Rep Loc 
Instance details

Defined in Language.Haskell.TH.Syntax

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

Monad transformer that adds a new logging function.

Since: monad-logger-0.2.2

Constructors

LoggingT 

Fields

Instances

Instances details
MonadTransControl LoggingT 
Instance details

Defined in Control.Monad.Logger

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 #

MonadTrans LoggingT 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadRWS r w s m => MonadRWS r w s (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

MonadBaseControl b m => MonadBaseControl b (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

MonadError e m => MonadError e (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

throwError :: e -> LoggingT m a #

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

MonadReader r m => MonadReader r (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

ask :: LoggingT m r #

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

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

MonadState s m => MonadState s (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

get :: LoggingT m s #

put :: s -> LoggingT m () #

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

MonadWriter w m => MonadWriter w (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

MonadBase b m => MonadBase b (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

liftBase :: b α -> LoggingT m α #

MonadFail m => MonadFail (LoggingT m)

Since: monad-logger-0.3.30

Instance details

Defined in Control.Monad.Logger

Methods

fail :: String -> LoggingT m a #

MonadIO m => MonadIO (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

liftIO :: IO a -> LoggingT m a #

Alternative m => Alternative (LoggingT m)

Since: monad-logger-0.3.40

Instance details

Defined in Control.Monad.Logger

Methods

empty :: LoggingT m a #

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

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

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

Applicative m => Applicative (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

Functor m => Functor (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

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

Monad m => Monad (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

MonadActive m => MonadActive (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

MonadCatch m => MonadCatch (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadMask m => MonadMask (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

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

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

MonadThrow m => MonadThrow (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

throwM :: (HasCallStack, Exception e) => e -> LoggingT m a #

MonadIO m => MonadLogger (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadIO m => MonadLoggerIO (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadCont m => MonadCont (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadResource m => MonadResource (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadUnliftIO m => MonadUnliftIO (LoggingT m)

Since: monad-logger-0.3.26

Instance details

Defined in Control.Monad.Logger

Methods

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

(Applicative m, Monoid a) => Monoid (LoggingT m a) 
Instance details

Defined in Control.Monad.Logger

Methods

mempty :: LoggingT m a #

mappend :: LoggingT m a -> LoggingT m a -> LoggingT m a #

mconcat :: [LoggingT m a] -> LoggingT m a #

(Applicative m, Semigroup a) => Semigroup (LoggingT m a) 
Instance details

Defined in Control.Monad.Logger

Methods

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

sconcat :: NonEmpty (LoggingT m a) -> LoggingT m a #

stimes :: Integral b => b -> LoggingT m a -> LoggingT m a #

type StT LoggingT a 
Instance details

Defined in Control.Monad.Logger

type StT LoggingT a = a
type StM (LoggingT m) a 
Instance details

Defined in Control.Monad.Logger

type StM (LoggingT m) a = StM m a

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

Since: monad-logger-0.3.28

Constructors

WriterLoggingT 

Fields

Instances

Instances details
MonadTransControl WriterLoggingT 
Instance details

Defined in Control.Monad.Logger

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 #

MonadTrans WriterLoggingT 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadBaseControl b m => MonadBaseControl b (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Associated Types

type StM (WriterLoggingT m) a #

MonadBase b m => MonadBase b (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

liftBase :: b α -> WriterLoggingT m α #

MonadIO m => MonadIO (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

liftIO :: IO a -> WriterLoggingT m a #

Applicative m => Applicative (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

Functor m => Functor (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

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

Monad m => Monad (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

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

return :: a -> WriterLoggingT m a #

MonadCatch m => MonadCatch (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadMask m => MonadMask (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

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

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

MonadThrow m => MonadThrow (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

throwM :: (HasCallStack, Exception e) => e -> WriterLoggingT m a #

Monad m => MonadLogger (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(Applicative m, Monoid a) => Monoid (WriterLoggingT m a) 
Instance details

Defined in Control.Monad.Logger

(Applicative m, Semigroup a) => Semigroup (WriterLoggingT m a) 
Instance details

Defined in Control.Monad.Logger

type StT WriterLoggingT a 
Instance details

Defined in Control.Monad.Logger

type StT WriterLoggingT a = (a, DList LogLine)
type StM (WriterLoggingT m) a 
Instance details

Defined in Control.Monad.Logger

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

Since: monad-logger-0.3.32

newtype NoLoggingT (m :: Type -> Type) a #

Monad transformer that disables logging.

Since: monad-logger-0.2.4

Constructors

NoLoggingT 

Fields

Instances

Instances details
MonadTransControl NoLoggingT 
Instance details

Defined in Control.Monad.Logger

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 #

MonadTrans NoLoggingT 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadBaseControl b m => MonadBaseControl b (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

MonadError e m => MonadError e (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

throwError :: e -> NoLoggingT m a #

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

MonadReader r m => MonadReader r (NoLoggingT m)

Since: monad-logger-0.3.24

Instance details

Defined in Control.Monad.Logger

Methods

ask :: NoLoggingT m r #

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

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

MonadState s m => MonadState s (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

get :: NoLoggingT m s #

put :: s -> NoLoggingT m () #

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

MonadWriter w m => MonadWriter w (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

MonadBase b m => MonadBase b (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

liftBase :: b α -> NoLoggingT m α #

MonadFail m => MonadFail (NoLoggingT m)

Since: monad-logger-0.3.30

Instance details

Defined in Control.Monad.Logger

Methods

fail :: String -> NoLoggingT m a #

MonadIO m => MonadIO (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

liftIO :: IO a -> NoLoggingT m a #

Alternative m => Alternative (NoLoggingT m)

Since: monad-logger-0.3.40

Instance details

Defined in Control.Monad.Logger

Methods

empty :: NoLoggingT m a #

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

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

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

Applicative m => Applicative (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

Functor m => Functor (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

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

Monad m => Monad (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

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 #

MonadActive m => MonadActive (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

MonadCatch m => MonadCatch (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadMask m => MonadMask (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

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

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

MonadThrow m => MonadThrow (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

throwM :: (HasCallStack, Exception e) => e -> NoLoggingT m a #

Monad m => MonadLogger (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadIO m => MonadLoggerIO (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadResource m => MonadResource (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

MonadUnliftIO m => MonadUnliftIO (NoLoggingT m)

Since: monad-logger-0.3.26

Instance details

Defined in Control.Monad.Logger

Methods

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

(Applicative m, Monoid a) => Monoid (NoLoggingT m a) 
Instance details

Defined in Control.Monad.Logger

Methods

mempty :: NoLoggingT m a #

mappend :: NoLoggingT m a -> NoLoggingT m a -> NoLoggingT m a #

mconcat :: [NoLoggingT m a] -> NoLoggingT m a #

(Applicative m, Semigroup a) => Semigroup (NoLoggingT m a) 
Instance details

Defined in Control.Monad.Logger

Methods

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

sconcat :: NonEmpty (NoLoggingT m a) -> NoLoggingT m a #

stimes :: Integral b => b -> NoLoggingT m a -> NoLoggingT m a #

type StT NoLoggingT a 
Instance details

Defined in Control.Monad.Logger

type StT NoLoggingT a = a
type StM (NoLoggingT m) a 
Instance details

Defined in Control.Monad.Logger

type StM (NoLoggingT m) a = StM m a

class (MonadLogger m, MonadIO m) => MonadLoggerIO (m :: Type -> Type) where #

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: monad-logger-0.3.10

Minimal complete definition

Nothing

Methods

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

Request the logging function itself.

Since: monad-logger-0.3.10

Instances

Instances details
MonadIO m => MonadLoggerIO (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadIO m => MonadLoggerIO (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (ResourceT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (MaybeT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (ExceptT e m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (IdentityT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (ReaderT r m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (StateT s m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (StateT s m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(MonadLoggerIO m, Monoid w) => MonadLoggerIO (WriterT w m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(MonadLoggerIO m, Monoid w) => MonadLoggerIO (WriterT w m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (ConduitM i o m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (ContT r m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(MonadLoggerIO m, Monoid w) => MonadLoggerIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(MonadLoggerIO m, Monoid w) => MonadLoggerIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLoggerIO m => MonadLoggerIO (Pipe l i o u m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

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

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 () #

Instances

Instances details
MonadIO m => MonadLogger (LoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

Monad m => MonadLogger (NoLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

Monad m => MonadLogger (WriterLoggingT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (ResourceT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (MaybeT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (ExceptT e m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (IdentityT m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (ReaderT r m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (StateT s m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (StateT s m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(MonadLogger m, Monoid w) => MonadLogger (WriterT w m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(MonadLogger m, Monoid w) => MonadLogger (WriterT w m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (ConduitM i o m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (ContT r m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(MonadLogger m, Monoid w) => MonadLogger (RWST r w s m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

(MonadLogger m, Monoid w) => MonadLogger (RWST r w s m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

MonadLogger m => MonadLogger (Pipe l i o u m) 
Instance details

Defined in Control.Monad.Logger

Methods

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

data LogLevel #

Instances

Instances details
Read LogLevel 
Instance details

Defined in Control.Monad.Logger

Show LogLevel 
Instance details

Defined in Control.Monad.Logger

Eq LogLevel 
Instance details

Defined in Control.Monad.Logger

Ord LogLevel 
Instance details

Defined in Control.Monad.Logger

Lift LogLevel 
Instance details

Defined in Control.Monad.Logger

Methods

lift :: Quote m => LogLevel -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => LogLevel -> Code m LogLevel #

logDebugSH :: Q Exp #

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

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

Since: monad-logger-0.3.18

logOtherSH :: Text -> Q Exp #

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

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

liftLoc :: Loc -> Q Exp #

Lift a location into an Exp.

Since: monad-logger-0.3.1

logDebugS :: Q Exp #

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 #

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"

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

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

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

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

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

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: monad-logger-0.3.17

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

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: monad-logger-0.3.17

withChannelLogger #

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: monad-logger-0.3.2

filterLogger :: forall (m :: Type -> Type) a. (LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a #

Only log messages passing the given predicate function.

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

Since: monad-logger-0.3.13

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

Map the unwrapped computation using the given function.

Since: monad-logger-0.3.29

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

Map the unwrapped computation using the given function.

Since: monad-logger-0.3.29

defaultLoc :: Loc #

dummy location, used with logWithoutLoc

Since: monad-logger-0.3.23