Safe Haskell | None |
---|
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
- data SyslogUsage
- syslogUsageFromRaw :: forall m. (Monad m, MonadFail m) => String -> m SyslogUsage
- syslogUsageToRaw :: SyslogUsage -> String
- logFormatter :: String -> Bool -> Bool -> LogFormatter a
- openFormattedHandler :: LogHandler a => Bool -> LogFormatter a -> IO a -> IO [a]
- setupLogging :: Maybe String -> String -> Bool -> Bool -> Bool -> SyslogUsage -> IO ()
- class Monad m => MonadLog m where
- logAt :: Priority -> String -> m ()
- logDebug :: MonadLog m => String -> m ()
- logInfo :: MonadLog m => String -> m ()
- logNotice :: MonadLog m => String -> m ()
- logWarning :: MonadLog m => String -> m ()
- logError :: MonadLog m => String -> m ()
- logCritical :: MonadLog m => String -> m ()
- logAlert :: MonadLog m => String -> m ()
- logEmergency :: MonadLog m => String -> m ()
- isDebugMode :: IO Bool
- withErrorLogAt :: (MonadLog m, MonadError e m, Show e) => Priority -> String -> m a -> m a
Documentation
data SyslogUsage Source #
Syslog usage type.
Instances
syslogUsageFromRaw :: forall m. (Monad m, MonadFail m) => String -> m SyslogUsage Source #
syslogUsageToRaw :: SyslogUsage -> String Source #
:: 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.
:: 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.
Instances
MonadLog IO # | |
Defined in Ganeti.Logging | |
MonadLog MetadMonadInt # | |
Defined in Ganeti.Metad.ConfigCore logAt :: Priority -> String -> MetadMonadInt () Source # | |
MonadLog WConfdMonadInt # | |
Defined in Ganeti.WConfd.Monad logAt :: Priority -> String -> WConfdMonadInt () Source # | |
MonadLog m => MonadLog (MaybeT m) # | |
Defined in Ganeti.Logging | |
Monad m => MonadLog (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog logAt :: Priority -> String -> WriterLogT m () Source # | |
MonadLog m => MonadLog (IdentityT m) # | |
Defined in Ganeti.Logging | |
MonadLog m => MonadLog (ReaderT r m) # | |
Defined in Ganeti.Logging | |
MonadLog m => MonadLog (StateT s m) # | |
Defined in Ganeti.Logging | |
(MonadLog m, Error e) => MonadLog (ResultT e m) # | |
Defined in Ganeti.Logging | |
(MonadLog m, Monoid w) => MonadLog (RWST r w s m) # | |
Defined in Ganeti.Logging |
logWarning :: MonadLog m => String -> m () Source #
Log at warning level.
logCritical :: MonadLog m => String -> m () Source #
Log at critical 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.