Module CPM.ErrorLogger

Contains combinators for chaining IO actions that can fail and log messages.

Summary of exported operations:

logLevelOf :: LogEntry -> LogLevel  Deterministic 
showLogEntry :: LogLevel -> LogEntry -> IO ()  Deterministic 
Renders a log entry to stderr.
levelGte :: LogLevel -> LogLevel -> Bool  Deterministic 
Compares two log levels.
logAt :: LogLevel -> String -> ErrorLogger ()  Deterministic 
Logs a message at a user-defined level.
logInfo :: String -> ErrorLogger ()  Deterministic 
Logs a message at the info level.
logDebug :: String -> ErrorLogger ()  Deterministic 
Logs a message at the debug level.
logError :: String -> ErrorLogger ()  Deterministic 
Logs a message at the error level.
logCritical :: String -> ErrorLogger ()  Deterministic 
Logs a message at the critical level.
putStrELM :: String -> ErrorLogger ()  Deterministic 
Prints a string in the ErrorLogger monad.
putStrLnELM :: String -> ErrorLogger ()  Deterministic 
Prints a line in the ErrorLogger monad.
fromErrorLogger :: LogLevel -> Bool -> ErrorLogger a -> IO a  Deterministic 
Transforms an error logger action into a standard IO action.
showExecCmd :: String -> ErrorLogger Int  Deterministic 
Executes a system command and show the command as debug message.
execQuietCmd :: (String -> String) -> ErrorLogger Int  Deterministic 
Executes a parameterized system command.
getLogLevel :: ErrorLogger LogLevel  Deterministic 
getWithShowTime :: ErrorLogger Bool  Deterministic 
setLogLevel :: LogLevel -> ErrorLogger ()  Deterministic 
setWithShowTime :: Bool -> ErrorLogger ()  Deterministic 
liftIOEL :: IO a -> ErrorLogger a  Deterministic 
tryEL :: ErrorLogger a -> ErrorLogger (Either LogEntry a)  Deterministic 
Tries to execute an EL action and returns either an error that occurred or the value.
inDirectoryEL :: String -> ErrorLogger a -> ErrorLogger a  Deterministic 
Executes an EL action with the current directory set to a specific directory.
inTempDirEL :: ErrorLogger a -> ErrorLogger a  Deterministic 
Executes an EL action with the current directory set to CPM's temporary directory.

Exported datatypes:


LogEntry

A log entry.

Constructors:


LogLevel

A log level.

Constructors:

  • Quiet :: LogLevel
  • Info :: LogLevel
  • Debug :: LogLevel
  • Error :: LogLevel
  • Critical :: LogLevel

Exported operations:

logLevelOf :: LogEntry -> LogLevel  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

showLogEntry :: LogLevel -> LogEntry -> IO ()  Deterministic 

Renders a log entry to stderr.

levelGte :: LogLevel -> LogLevel -> Bool  Deterministic 

Compares two log levels.

Further infos:
  • solution complete, i.e., able to compute all solutions

logAt :: LogLevel -> String -> ErrorLogger ()  Deterministic 

Logs a message at a user-defined level.

logInfo :: String -> ErrorLogger ()  Deterministic 

Logs a message at the info level.

logDebug :: String -> ErrorLogger ()  Deterministic 

Logs a message at the debug level.

logError :: String -> ErrorLogger ()  Deterministic 

Logs a message at the error level.

logCritical :: String -> ErrorLogger ()  Deterministic 

Logs a message at the critical level.

putStrELM :: String -> ErrorLogger ()  Deterministic 

Prints a string in the ErrorLogger monad.

putStrLnELM :: String -> ErrorLogger ()  Deterministic 

Prints a line in the ErrorLogger monad.

fromErrorLogger :: LogLevel -> Bool -> ErrorLogger a -> IO a  Deterministic 

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. The first argument specifies the logging level for messages. If the second argument is true, timings are shown in the messages.

showExecCmd :: String -> ErrorLogger Int  Deterministic 

Executes a system command and show the command as debug message.

execQuietCmd :: (String -> String) -> ErrorLogger Int  Deterministic 

Executes a parameterized system command. The parameter is set to -q unless the LogLevel is Debug.

setWithShowTime :: Bool -> ErrorLogger ()  Deterministic 

liftIOEL :: IO a -> ErrorLogger a  Deterministic 

tryEL :: ErrorLogger a -> ErrorLogger (Either LogEntry a)  Deterministic 

Tries to execute an EL action and returns either an error that occurred or the value.

inDirectoryEL :: String -> ErrorLogger a -> ErrorLogger a  Deterministic 

Executes an EL action with the current directory set to a specific directory.

inTempDirEL :: ErrorLogger a -> ErrorLogger a  Deterministic 

Executes an EL action with the current directory set to CPM's temporary directory.