ganeti
Safe HaskellNone

Ganeti.Logging

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

Instances details
Bounded SyslogUsage # 
Instance details

Defined in Ganeti.Logging

Enum SyslogUsage # 
Instance details

Defined in Ganeti.Logging

Eq SyslogUsage # 
Instance details

Defined in Ganeti.Logging

Methods

(==) :: SyslogUsage -> SyslogUsage -> Bool

(/=) :: SyslogUsage -> SyslogUsage -> Bool

Ord SyslogUsage # 
Instance details

Defined in Ganeti.Logging

Show SyslogUsage # 
Instance details

Defined in Ganeti.Logging

Methods

showsPrec :: Int -> SyslogUsage -> ShowS

show :: SyslogUsage -> String

showList :: [SyslogUsage] -> ShowS

syslogUsageFromRaw :: forall m. (Monad m, MonadFail m) => String -> m SyslogUsage Source #

logFormatter Source #

Arguments

:: String

Program

-> Bool

Multithreaded

-> Bool

Syslog

-> LogFormatter a 

Builds the log formatter.

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

Helper to open and set the formatter on a log if enabled by a given condition, otherwise returning an empty list.

setupLogging Source #

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 where Source #

A monad that allows logging.

Methods

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

Log at a given level.

Instances

Instances details
MonadLog IO # 
Instance details

Defined in Ganeti.Logging

Methods

logAt :: Priority -> String -> IO () Source #

MonadLog MetadMonadInt # 
Instance details

Defined in Ganeti.Metad.ConfigCore

Methods

logAt :: Priority -> String -> MetadMonadInt () Source #

MonadLog WConfdMonadInt # 
Instance details

Defined in Ganeti.WConfd.Monad

Methods

logAt :: Priority -> String -> WConfdMonadInt () Source #

MonadLog m => MonadLog (MaybeT m) # 
Instance details

Defined in Ganeti.Logging

Methods

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

Monad m => MonadLog (WriterLogT m) # 
Instance details

Defined in Ganeti.Logging.WriterLog

Methods

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

MonadLog m => MonadLog (IdentityT m) # 
Instance details

Defined in Ganeti.Logging

Methods

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

MonadLog m => MonadLog (ReaderT r m) # 
Instance details

Defined in Ganeti.Logging

Methods

logAt :: Priority -> String -> ReaderT r m () Source #

MonadLog m => MonadLog (StateT s m) # 
Instance details

Defined in Ganeti.Logging

Methods

logAt :: Priority -> String -> StateT s m () Source #

(MonadLog m, Error e) => MonadLog (ResultT e m) # 
Instance details

Defined in Ganeti.Logging

Methods

logAt :: Priority -> String -> ResultT e m () Source #

(MonadLog m, Monoid w) => MonadLog (RWST r w s m) # 
Instance details

Defined in Ganeti.Logging

Methods

logAt :: Priority -> String -> RWST r w s m () Source #

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 Bool Source #

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 a Source #

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