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.
- data SyslogUsage
- = SyslogNo
- | SyslogYes
- | SyslogOnly
- syslogUsageFromRaw :: forall m. Monad 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.
Bounded SyslogUsage | |
Enum SyslogUsage | |
Eq SyslogUsage | |
Ord SyslogUsage | |
Show SyslogUsage |
syslogUsageFromRaw :: forall m. Monad m => String -> m SyslogUsageSource
syslogUsageToRaw :: SyslogUsage -> StringSource
logFormatter :: String -> Bool -> Bool -> LogFormatter aSource
openFormattedHandler :: LogHandler a => Bool -> LogFormatter a -> IO a -> IO [a]Source
:: 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.
MonadLog IO | |
MonadLog WConfdMonadInt | |
MonadLog MetadMonadInt | |
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, FromString e) => MonadLog (ResultT e m) | |
(MonadLog m, Monoid w) => MonadLog (RWST r w s m) |
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 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.