-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A class of monads which can log messages.
--   
--   Hackage documentation generation is not reliable. For up to date
--   documentation, please see:
--   <a>http://www.stackage.org/package/monad-logger</a>.
@package monad-logger
@version 0.3.22


-- | This module provides the facilities needed for a decoupled logging
--   system.
--   
--   The <a>MonadLogger</a> 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 <a>MonadLogger</a> that routes the log messages
--   to the appropriate place (e.g., that's what <tt>yesod-core</tt>'s
--   <tt>GHandler</tt> does). Otherwise, you may use the <a>LoggingT</a>
--   monad included in this module (see <a>runStderrLoggingT</a>). To
--   simply discard log message, use <a>NoLoggingT</a>.
--   
--   As a user of the logging facility, we provide you some convenient
--   Template Haskell splices that use the <a>MonadLogger</a> class. They
--   will record their source file and position, which is very helpful when
--   debugging. See <a>logDebug</a> for more information.
module Control.Monad.Logger

-- | A <tt>Monad</tt> which has the ability to log messages in some manner.
class Monad m => MonadLogger m where monadLoggerLog loc src lvl msg = lift $ monadLoggerLog loc src lvl msg
monadLoggerLog :: (MonadLogger m, ToLogStr msg) => Loc -> LogSource -> LogLevel -> msg -> m ()
monadLoggerLog :: (MonadLogger m, MonadLogger m', MonadTrans t, MonadLogger (t m'), ToLogStr msg, m ~ t m') => Loc -> LogSource -> LogLevel -> msg -> m ()

-- | An extension of <tt>MonadLogger</tt> for the common case where the
--   logging action is a simple <tt>IO</tt> 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
class (MonadLogger m, MonadIO m) => MonadLoggerIO m where askLoggerIO = lift askLoggerIO

-- | Request the logging function itself.
--   
--   Since 0.3.10
askLoggerIO :: MonadLoggerIO m => m (Loc -> LogSource -> LogLevel -> LogStr -> IO ())

-- | Request the logging function itself.
--   
--   Since 0.3.10
askLoggerIO :: (MonadLoggerIO m, MonadTrans t, MonadLoggerIO n, m ~ t n) => m (Loc -> LogSource -> LogLevel -> LogStr -> IO ())
data LogLevel
LevelDebug :: LogLevel
LevelInfo :: LogLevel
LevelWarn :: LogLevel
LevelError :: LogLevel
LevelOther :: Text -> LogLevel
type LogSource = Text

-- | Log message builder. Use (<a>&lt;&gt;</a>) to append two LogStr in
--   O(1).
data LogStr :: *
class ToLogStr msg
toLogStr :: msg -> LogStr

-- | Monad transformer that adds a new logging function.
--   
--   Since 0.2.2
newtype LoggingT m a
LoggingT :: ((Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> m a) -> LoggingT m a
[runLoggingT] :: LoggingT m a -> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> m a

-- | Run a block using a <tt>MonadLogger</tt> instance which prints to
--   stderr.
--   
--   Since 0.2.2
runStderrLoggingT :: MonadIO m => LoggingT m a -> m a

-- | Run a block using a <tt>MonadLogger</tt> instance which prints to
--   stdout.
--   
--   Since 0.2.2
runStdoutLoggingT :: MonadIO m => LoggingT m a -> m a

-- | Run a block using a <tt>MonadLogger</tt> instance which writes tuples
--   to an unbounded channel.
--   
--   The tuples can be extracted (ie. in another thread) with
--   <a>unChanLoggingT</a> or a custom extraction funtion, and written to a
--   destination.
runChanLoggingT :: MonadIO m => Chan (Loc, LogSource, LogLevel, LogStr) -> LoggingT m a -> m a

-- | Run a block using a <tt>MonadLogger</tt> instance which appends to the
--   specified file.
runFileLoggingT :: MonadBaseControl IO m => FilePath -> LoggingT m a -> m a

-- | Read logging tuples from an unbounded channel and log them into a
--   <a>MonadLoggerIO</a> monad, forever.
--   
--   For use in a dedicated thread with a channel fed by
--   <a>runChanLoggingT</a>.
unChanLoggingT :: (MonadLogger m, MonadIO m) => Chan (Loc, LogSource, LogLevel, LogStr) -> m void

-- | Within the <a>LoggingT</a> 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
withChannelLogger :: (MonadBaseControl IO m, MonadIO m) => Int -> 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 0.3.13
filterLogger :: (LogSource -> LogLevel -> Bool) -> LoggingT m a -> LoggingT m a

-- | Monad transformer that disables logging.
--   
--   Since 0.2.4
newtype NoLoggingT m a
NoLoggingT :: m a -> NoLoggingT m a
[runNoLoggingT] :: NoLoggingT m a -> m a

-- | Generates a function that takes a <a>Text</a> and logs a
--   <a>LevelDebug</a> message. Usage:
--   
--   <pre>
--   $(logDebug) "This is a debug log message"
--   </pre>
logDebug :: Q Exp

-- | See <a>logDebug</a>
logInfo :: Q Exp

-- | See <a>logDebug</a>
logWarn :: Q Exp

-- | See <a>logDebug</a>
logError :: Q Exp

-- | Generates a function that takes a <a>Text</a> and logs a
--   <a>LevelOther</a> message. Usage:
--   
--   <pre>
--   $(logOther "My new level") "This is a log message"
--   </pre>
logOther :: Text -> Q Exp

-- | Generates a function that takes a 'Show a =&gt; a' and logs a
--   <a>LevelDebug</a> message. Usage:
--   
--   <pre>
--   $(logDebugSH) (Just "This is a debug log message")
--   </pre>
logDebugSH :: Q Exp

-- | See <a>logDebugSH</a>
logInfoSH :: Q Exp

-- | See <a>logDebugSH</a>
logWarnSH :: Q Exp

-- | See <a>logDebugSH</a>
logErrorSH :: Q Exp

-- | Generates a function that takes a 'Show a =&gt; a' and logs a
--   <a>LevelOther</a> message. Usage:
--   
--   <pre>
--   $(logOtherSH "My new level") "This is a log message"
--   </pre>
logOtherSH :: Text -> Q Exp

-- | Generates a function that takes a <a>LogSource</a> and <a>Text</a> and
--   logs a <a>LevelDebug</a> message. Usage:
--   
--   <pre>
--   $logDebugS "SomeSource" "This is a debug log message"
--   </pre>
logDebugS :: Q Exp

-- | See <a>logDebugS</a>
logInfoS :: Q Exp

-- | See <a>logDebugS</a>
logWarnS :: Q Exp

-- | See <a>logDebugS</a>
logErrorS :: Q Exp

-- | Generates a function that takes a <a>LogSource</a>, a level name and a
--   <a>Text</a> and logs a <a>LevelOther</a> message. Usage:
--   
--   <pre>
--   $logOtherS "SomeSource" "My new level" "This is a log message"
--   </pre>
logOtherS :: Q Exp

-- | Lift a location into an Exp.
--   
--   Since 0.3.1
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 ()
logDebugNS :: MonadLogger m => Text -> Text -> m ()
logInfoNS :: MonadLogger m => Text -> Text -> m ()
logWarnNS :: MonadLogger m => Text -> Text -> m ()
logErrorNS :: MonadLogger m => Text -> Text -> m ()
logOtherNS :: MonadLogger m => Text -> LogLevel -> Text -> m ()

-- | Logs a message with location given by <a>CallStack</a>. See
--   <a>CallStack</a> for more convenient functions for <a>CallStack</a>
--   based logging.
logDebugCS :: MonadLogger m => CallStack -> Text -> m ()

-- | See <a>logDebugCS</a>
logInfoCS :: MonadLogger m => CallStack -> Text -> m ()

-- | See <a>logDebugCS</a>
logWarnCS :: MonadLogger m => CallStack -> Text -> m ()

-- | See <a>logDebugCS</a>
logErrorCS :: MonadLogger m => CallStack -> Text -> m ()

-- | See <a>logDebugCS</a>
logOtherCS :: MonadLogger m => CallStack -> LogLevel -> Text -> m ()
defaultLogStr :: Loc -> LogSource -> LogLevel -> LogStr -> LogStr
data Loc :: *
Loc :: String -> String -> String -> CharPos -> CharPos -> Loc
[loc_filename] :: Loc -> String
[loc_package] :: Loc -> String
[loc_module] :: Loc -> String
[loc_start] :: Loc -> CharPos
[loc_end] :: Loc -> CharPos
instance GHC.Classes.Ord Control.Monad.Logger.LogLevel
instance GHC.Read.Read Control.Monad.Logger.LogLevel
instance GHC.Show.Show Control.Monad.Logger.LogLevel
instance GHC.Classes.Eq Control.Monad.Logger.LogLevel
instance Language.Haskell.TH.Syntax.Lift Control.Monad.Logger.LogLevel
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Identity.IdentityT m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.List.ListT m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Maybe.MaybeT m)
instance (Control.Monad.Logger.MonadLogger m, Control.Monad.Trans.Error.Error e) => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Error.ErrorT e m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Except.ExceptT e m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Reader.ReaderT r m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Cont.ContT r m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.State.Lazy.StateT s m)
instance (Control.Monad.Logger.MonadLogger m, GHC.Base.Monoid w) => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (Control.Monad.Logger.MonadLogger m, GHC.Base.Monoid w) => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Resource.Internal.ResourceT m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Data.Conduit.Internal.Pipe.Pipe l i o u m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Data.Conduit.Internal.Conduit.ConduitM i o m)
instance Control.Monad.Logger.MonadLogger m => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.State.Strict.StateT s m)
instance (Control.Monad.Logger.MonadLogger m, GHC.Base.Monoid w) => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (Control.Monad.Logger.MonadLogger m, GHC.Base.Monoid w) => Control.Monad.Logger.MonadLogger (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Identity.IdentityT m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.List.ListT m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Maybe.MaybeT m)
instance (Control.Monad.Logger.MonadLoggerIO m, Control.Monad.Trans.Error.Error e) => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Error.ErrorT e m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Except.ExceptT e m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Reader.ReaderT r m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Cont.ContT r m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.State.Lazy.StateT s m)
instance (Control.Monad.Logger.MonadLoggerIO m, GHC.Base.Monoid w) => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (Control.Monad.Logger.MonadLoggerIO m, GHC.Base.Monoid w) => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Resource.Internal.ResourceT m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Data.Conduit.Internal.Pipe.Pipe l i o u m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Data.Conduit.Internal.Conduit.ConduitM i o m)
instance Control.Monad.Logger.MonadLoggerIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.State.Strict.StateT s m)
instance (Control.Monad.Logger.MonadLoggerIO m, GHC.Base.Monoid w) => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (Control.Monad.Logger.MonadLoggerIO m, GHC.Base.Monoid w) => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Logger.NoLoggingT m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Monad.Logger.NoLoggingT m)
instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.Catch.MonadMask m => Control.Monad.Catch.MonadMask (Control.Monad.Logger.NoLoggingT m)
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Control.Monad.Logger.NoLoggingT m)
instance Data.Conduit.Lazy.MonadActive m => Data.Conduit.Lazy.MonadActive (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Trans.Resource.Internal.MonadResource m => Control.Monad.Trans.Resource.Internal.MonadResource (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.Trans.Class.MonadTrans Control.Monad.Logger.NoLoggingT
instance Control.Monad.Trans.Control.MonadTransControl Control.Monad.Logger.NoLoggingT
instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Logger.NoLoggingT m)
instance GHC.Base.Monad m => Control.Monad.Logger.MonadLogger (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Logger.NoLoggingT m)
instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Logger.LoggingT m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Monad.Logger.LoggingT m)
instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Logger.LoggingT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Catch.MonadMask m => Control.Monad.Catch.MonadMask (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Trans.Resource.Internal.MonadResource m => Control.Monad.Trans.Resource.Internal.MonadResource (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Trans.Class.MonadTrans Control.Monad.Logger.LoggingT
instance Control.Monad.Trans.Control.MonadTransControl Control.Monad.Logger.LoggingT
instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Logger.LoggingT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.Logger.MonadLogger (Control.Monad.Logger.LoggingT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.Logger.MonadLoggerIO (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.RWS.Class.MonadRWS r w s m => Control.Monad.RWS.Class.MonadRWS r w s (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Logger.LoggingT m)
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Monad.Logger.LoggingT m)
instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Logger.LoggingT m)
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Monad.Logger.NoLoggingT m)
instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Logger.NoLoggingT m)


-- | Log functions using CallStack support in place of Template Haskell
module Control.Monad.Logger.CallStack

-- | Logs a message with the location provided by an implicit
--   <a>CallStack</a>.
logDebug :: (HasCallStack, MonadLogger m) => Text -> m ()

-- | See <a>logDebug</a>
logInfo :: (HasCallStack, MonadLogger m) => Text -> m ()

-- | See <a>logDebug</a>
logWarn :: (HasCallStack, MonadLogger m) => Text -> m ()

-- | See <a>logDebug</a>
logError :: (HasCallStack, MonadLogger m) => Text -> m ()
