Safe Haskell | None |
---|
Quick example of how to use this module:
import Control.Logging main = withStdoutLogging $ do log This is a log message! timedLog This is a timed log message! $ threadDelay 100000
- log :: MonadLogger m => Text -> m ()
- log' :: (MonadLogger m, MonadIO m) => Text -> m ()
- warn :: MonadLogger m => Text -> m ()
- warn' :: (MonadLogger m, MonadIO m) => Text -> m ()
- debug :: MonadLogger m => Text -> m ()
- debug' :: (MonadLogger m, MonadIO m) => Text -> m ()
- errorL :: Text -> a
- errorL' :: Text -> a
- traceL :: Text -> a -> a
- traceL' :: Text -> a -> a
- traceShowL :: Show a => a -> a1 -> a1
- traceShowL' :: Show a => a -> a1 -> a1
- timedLog :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()
- timedLog' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()
- timedLogEnd :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()
- timedLogEnd' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()
- timedDebug :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()
- timedDebug' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()
- timedDebugEnd :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()
- timedDebugEnd' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()
- withStdoutLogging :: (MonadBaseControl IO m, MonadIO m) => m a -> m a
- withStderrLogging :: (MonadBaseControl IO m, MonadIO m) => m a -> m a
- flushLog :: MonadIO m => m ()
- setDebugLevel :: LogLevel -> IO ()
- setLogFormat :: String -> IO ()
Documentation
log :: MonadLogger m => Text -> m ()Source
Synonym for logInfoN
. This module provides a
MonadLogger
instance for IO, so this function can be used directly in
IO. The only requirement is that you must surround the body of your
main
function with a call to withStdoutLogging
or
withStderrLogging
, to ensure that all logging buffers are properly
flushed on exit.
log' :: (MonadLogger m, MonadIO m) => Text -> m ()Source
The apostrophe varients of the logging functions flush the log after each message.
warn :: MonadLogger m => Text -> m ()Source
warn' :: (MonadLogger m, MonadIO m) => Text -> m ()Source
debug :: MonadLogger m => Text -> m ()Source
debug' :: (MonadLogger m, MonadIO m) => Text -> m ()Source
A logging variant of error
which uses unsafePerformIO
to output a log
message before calling error
.
traceShowL :: Show a => a -> a1 -> a1Source
traceShowL' :: Show a => a -> a1 -> a1Source
timedLog :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()Source
Output a logging message both before an action begins, and after it ends, reporting the total length of time. If an exception occurred, it is also reported.
timedLog' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()Source
timedLogEnd :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()Source
Like timedLog
, except that it does only logs when the action has
completed or failed after it is done.
timedLogEnd' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()Source
timedDebug :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()Source
A debug variant of timedLog
.
timedDebug' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()Source
timedDebugEnd :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()Source
timedDebugEnd' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m () -> m ()Source
withStdoutLogging :: (MonadBaseControl IO m, MonadIO m) => m a -> m aSource
This function, or withStderrLogging
, must be wrapped around whatever
region of your application intends to use logging. Typically it would be
wrapped around the body of main
.
withStderrLogging :: (MonadBaseControl IO m, MonadIO m) => m a -> m aSource
setDebugLevel :: LogLevel -> IO ()Source
Set the verbosity level. Messages at our higher than this level are
displayed. It defaults to LevelDebug
.
setLogFormat :: String -> IO ()Source
Set the format used for log timestamps.