hyperion-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Hyperion.Log

Synopsis

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.

showText :: Show a => a -> Text Source #

rawText :: MonadIO m => Text -> m () 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

warn :: (Show a, MonadIO m) => Text -> a -> m () Source #

Same as info but prepended by "WARN: ".

err :: (Show a, MonadIO m) => a -> m () Source #

Shorthand for info "ERROR"

throw :: (MonadThrow m, MonadIO m, Exception e) => e -> m a Source #

Same as throwM but first logs the error using err

throwError :: MonadIO m => String -> m a Source #

Same as error but first logs the error using text by prepending "ERROR: " to the first argument.

redirectToFile :: FilePath -> IO () Source #

Redirects log output to file by rewrting stdout and stderr handles.