Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hyperion.Log
Contents
Synopsis
- showText :: Show a => a -> Text
- prettyShowText :: Show a => a -> Text
- rawText :: MonadIO m => Text -> m ()
- text :: MonadIO m => Text -> m ()
- info :: (Show a, MonadIO m) => Text -> a -> m ()
- warn :: (Show a, MonadIO m) => Text -> a -> m ()
- err :: (Show a, MonadIO m) => a -> m ()
- throw :: (MonadThrow m, MonadIO m, Exception e) => e -> m a
- throwError :: MonadIO m => String -> m a
- flush :: IO ()
- currentLogFile :: IORef (Maybe FilePath)
- getLogFile :: MonadIO m => m (Maybe FilePath)
- redirectToFile :: FilePath -> IO ()
General comments
This module contains some simple functions for logging and throwing errors.
The logging is done to stderr
.
The functions use errorConcurrent
to write to stderr (through text
).
The output can be redirected from stderr
to a file by using redirectToFile
.
prettyShowText :: Show a => a -> Text Source #
text :: MonadIO m => Text -> m () Source #
Outputs the first argument to log. Prepends current time in the format
[%a %D %X]
where %a
is day of the week, %D
is date in mm/dd/yy
format, %X
is
current time of day in some default locale.
info :: (Show a, MonadIO m) => Text -> a -> m () Source #
Outputs a string to log using text
where the string is a pretty version of the first
two arguments
throwError :: MonadIO m => String -> m a Source #