ganeti

Safe HaskellNone

Ganeti.Logging

Contents

Description

Implementation of the Ganeti logging functionality.

This currently lacks the following (FIXME):

  • log file reopening

Note that this requires the hslogger library version 1.1 and above.

Synopsis

Documentation

data SyslogUsage Source

Syslog usage type.

Constructors

SyslogNo 
SyslogYes 
SyslogOnly 

Instances

syslogUsageFromRaw :: forall m. Monad m => String -> m SyslogUsageSource

logFormatter :: String -> Bool -> Bool -> LogFormatter aSource

openFormattedHandler :: LogHandler a => Bool -> LogFormatter a -> IO a -> IO [a]Source

setupLoggingSource

Arguments

:: Maybe String

Log file

-> String

Program name

-> Bool

Debug level

-> Bool

Log to stderr

-> Bool

Log to console

-> SyslogUsage

Syslog usage

-> IO () 

Sets up the logging configuration.

Logging function aliases

class Monad m => MonadLog m whereSource

A monad that allows logging.

Methods

logAt :: Priority -> String -> m ()Source

Log at a given level.

Instances

MonadLog IO 
MonadLog WConfdMonadInt 
MonadLog m => MonadLog (MaybeT m) 
MonadLog m => MonadLog (IdentityT m) 
Monad m => MonadLog (WriterLogT m) 
MonadLog m => MonadLog (StateT s m) 
MonadLog m => MonadLog (ReaderT r m) 
(MonadLog m, Error e) => MonadLog (ResultT e m) 
(MonadLog m, Monoid w) => MonadLog (RWST r w s m) 

logDebug :: MonadLog m => String -> m ()Source

Log at debug level.

logInfo :: MonadLog m => String -> m ()Source

Log at info level.

logNotice :: MonadLog m => String -> m ()Source

Log at notice level.

logWarning :: MonadLog m => String -> m ()Source

Log at warning level.

logError :: MonadLog m => String -> m ()Source

Log at error level.

logCritical :: MonadLog m => String -> m ()Source

Log at critical level.

logAlert :: MonadLog m => String -> m ()Source

Log at alert level.

logEmergency :: MonadLog m => String -> m ()Source

Log at emergency level.

isDebugMode :: IO BoolSource

Check if the logging is at DEBUG level. DEBUG logging is unacceptable for production.

Logging in an error monad with rethrowing errors

withErrorLogAt :: (MonadLog m, MonadError e m, Show e) => Priority -> String -> m a -> m aSource

If an error occurs within a given computation, it annotated with a given message and logged and the error is re-thrown.