-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simplified logging in IO for application writers. -- -- logging is a wrapper around monad-logger and -- fast-logger which makes it easy to log from any -- MonadLogger environment, or from IO. It provides the -- following conveniences on top of those libraries: -- --
-- import Control.Logging -- -- main = withStdoutLogging $ do -- log This is a log message! -- timedLog This is a timed log message! $ threadDelay 100000 --module Control.Logging -- | 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 => Text -> m () -- | The apostrophe varients of the logging functions flush the log after -- each message. log' :: (MonadLogger m, MonadIO m) => Text -> m () logS :: MonadLogger m => Text -> Text -> m () logS' :: (MonadLogger m, MonadIO m) => Text -> Text -> m () warn :: MonadLogger m => Text -> m () warn' :: (MonadLogger m, MonadIO m) => Text -> m () warnS :: MonadLogger m => Text -> Text -> m () warnS' :: (MonadLogger m, MonadIO m) => Text -> Text -> m () debug :: MonadLogger m => Text -> m () debug' :: (MonadLogger m, MonadIO m) => Text -> m () debugS :: MonadLogger m => Text -> Text -> m () debugS' :: (MonadLogger m, MonadIO m) => Text -> Text -> m () -- | A logging variant of error which uses unsafePerformIO to -- output a log message before calling error. errorL :: Text -> a errorL' :: Text -> a errorSL :: Text -> Text -> a errorSL' :: Text -> Text -> a traceL :: Text -> a -> a traceL' :: Text -> a -> a traceSL :: Text -> Text -> a -> a traceSL' :: Text -> Text -> a -> a traceShowL :: Show a => a -> a1 -> a1 traceShowL' :: Show a => a -> a1 -> a1 traceShowSL :: Show a => Text -> a -> a1 -> a1 traceShowSL' :: Show a => Text -> a -> a1 -> a1 -- | 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 a -> m a timedLog' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m a -> m a timedLogS :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> Text -> m a -> m a timedLogS' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> Text -> m a -> m a -- | 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 a -> m a timedLogEnd' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m a -> m a timedLogEndS :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> Text -> m a -> m a timedLogEndS' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> Text -> m a -> m a -- | A debug variant of timedLog. timedDebug :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m a -> m a timedDebug' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m a -> m a timedDebugS :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> Text -> m a -> m a timedDebugS' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> Text -> m a -> m a timedDebugEnd :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m a -> m a timedDebugEnd' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> m a -> m a timedDebugEndS :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> Text -> m a -> m a timedDebugEndS' :: (MonadLogger m, MonadBaseControl IO m, MonadIO m) => Text -> Text -> m a -> m a -- | 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. withStdoutLogging :: (MonadBaseControl IO m, MonadIO m) => m a -> m a withStdoutLoggingUsing :: (MonadBaseControl IO m, MonadIO m) => LoggingLogger -> m a -> m a withStderrLogging :: (MonadBaseControl IO m, MonadIO m) => m a -> m a withStderrLoggingUsing :: (MonadBaseControl IO m, MonadIO m) => LoggingLogger -> m a -> m a withFileLogging :: (MonadBaseControl IO m, MonadIO m) => FilePath -> m a -> m a withFileLoggingUsing :: (MonadBaseControl IO m, MonadIO m) => LoggingLogger -> FilePath -> m a -> m a -- | Flush all collected logging messages. This is automatically called by -- withStdoutLogging and withStderrLogging when those -- blocks are exited by whatever means. flushLog :: MonadIO m => m () data LoggingLogger -- | This function is used to implement monadLoggerLog for the IO -- instance. You may reuse it if you wish, or it can be passed as an -- argument to runLoggingT -- in which case you must remember to -- call flushLog before the program exits. loggingLogger :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> IO () -- | Set the verbosity level. Messages at our higher than this level are -- displayed. It defaults to LevelDebug. setLogLevel :: LogLevel -> IO () -- | Set the format used for log timestamps. setLogTimeFormat :: String -> IO () setDebugSourceRegex :: String -> IO () instance MonadLogger IO