Contains combinators for chaining IO actions that can fail and log messages.
logLevelOf
:: LogEntry -> LogLevel
|
getLogLevel
:: IO LogLevel
Gets the global log level. |
setLogLevel
:: LogLevel -> IO ()
Sets the global log level. |
setWithShowTime
:: Bool -> IO ()
Sets the "show time" information. |
fromELM
:: ErrorLoggerIO a -> IO ([LogEntry],Either LogEntry a)
Transforms an ErrorLoggerIO
monad action into an IO action.
|
toELM
:: IO ([LogEntry],Either LogEntry a) -> ErrorLoggerIO a
Transforms an IO action into an ErrorLoggerIO
monad action.
|
execIO
:: IO a -> ErrorLoggerIO a
Executes an IO action in the ErrorLoggerIO
monad.
|
putStrELM
:: String -> ErrorLoggerIO ()
Prints a string in the ErrorLoggerIO
monad.
|
putStrLnELM
:: String -> ErrorLoggerIO ()
Prints a line in the ErrorLoggerIO
monad.
|
runELM
:: ErrorLoggerIO a -> IO a
Runs an ErrorLoggerIO
monad action as an IO action.
|
(|>=)
:: IO ([LogEntry],Either LogEntry a) -> (a -> IO ([LogEntry],Either LogEntry b)) -> IO ([LogEntry],Either LogEntry b)
|
(|>)
:: IO ([LogEntry],Either LogEntry a) -> IO ([LogEntry],Either LogEntry b) -> IO ([LogEntry],Either LogEntry b)
Chains two actions ignoring the result of the first. |
mapEL
:: (a -> IO ([LogEntry],Either LogEntry b)) -> [a] -> IO ([LogEntry],Either LogEntry [b])
Maps an action over a list of values. |
foldEL
:: (a -> b -> IO ([LogEntry],Either LogEntry a)) -> a -> [b] -> IO ([LogEntry],Either LogEntry a)
Folds a list of values using an action. |
showLogEntry
:: LogEntry -> IO ()
Renders a log entry to stderr. |
levelGte
:: LogLevel -> LogLevel -> Bool
Compares two log levels. |
succeedIO
:: a -> IO ([LogEntry],Either LogEntry a)
Create an IO action that always succeeds. |
failIO
:: String -> IO ([LogEntry],Either LogEntry a)
Create an IO action that always fails. |
failELM
:: String -> ErrorLoggerIO a
Create an ErrorLoggerIO
action that always fails with a message.
|
logMsg
:: LogLevel -> String -> ErrorLoggerIO ()
Creates an IO action that logs a message. |
log
:: LogLevel -> String -> IO ([LogEntry],Either LogEntry ())
Creates an IO action that logs a message. |
infoMessage
:: String -> IO ()
Prints an info message in the standard IO monad. |
debugMessage
:: String -> IO ()
Prints a debug message in the standard IO monad. |
errorMessage
:: String -> IO ()
Prints an error message in the standard IO monad. |
fromErrorLogger
:: IO ([LogEntry],Either LogEntry a) -> IO a
Transforms an error logger action into a standard IO action. |
showExecCmd
:: String -> IO Int
Executes a system command and show the command as debug message. |
execQuietCmd
:: (String -> String) -> IO Int
Executes a parameterized system command. |
An error logger.
Type synonym: ErrorLogger a = ([LogEntry],Either LogEntry a)
A log entry.
Constructors:
A log level.
Constructors:
Quiet
:: LogLevel
Info
:: LogLevel
Debug
:: LogLevel
Error
:: LogLevel
Critical
:: LogLevel
Datatype to define the ErrorLoggerIO
monad.
Constructors:
|
Gets the global log level. Messages below this level will not be printed. |
Sets the global log level. Messages below this level will not be printed. |
Sets the "show time" information. If true, then timing information will be shown with every log information. |
Transforms an
|
Transforms an IO action into an
|
Executes an IO action in the |
Prints a string in the |
Prints a line in the |
Runs an |
|
Chains two actions ignoring the result of the first.
|
Maps an action over a list of values. Fails if one of the actions fails. |
Folds a list of values using an action. Fails if one of the actions fails. |
Renders a log entry to stderr. |
Compares two log levels.
|
Create an |
Creates an IO action that logs a message. |
Creates an IO action that logs a message. |
Prints an info message in the standard IO monad. |
Prints a debug message in the standard IO monad. |
Prints an error message in the standard IO monad. |
Transforms an error logger action into a standard IO action. It shows all messages and, if the result is not available, exits with a non-zero code. |
Executes a system command and show the command as debug message. |
Executes a parameterized system command.
The parameter is set to |