Copyright | Copyright (C) 2004-2011 John Goerzen |
---|---|
License | BSD3 |
Maintainer | John Goerzen <jgoerzen@complete.org> |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Definition of log handler support
For some handlers, check out System.WLog.Handler.Simple and System.WLog.Handler.Syslog.
Please see System.WLog.Logger for extensive documentation on the logging system.
Written by John Goerzen, jgoerzen@complete.org
Synopsis
- data LogHandlerTag
- class LogHandler a where
- getTag :: a -> LogHandlerTag
- setLevel :: a -> Severities -> a
- getLevel :: a -> Severities
- setFormatter :: a -> LogFormatter a -> a
- getFormatter :: a -> LogFormatter a
- emit :: MonadIO m => a -> Builder -> Text -> m ()
- readBack :: MonadIO m => a -> Int -> m [Text]
- close :: MonadIO m => a -> m ()
- logHandlerMessage :: (MonadIO m, LogHandler a) => a -> LogRecord -> LoggerName -> m ()
Basic Types
data LogHandlerTag Source #
Tag identifying handlers.
Instances
Eq LogHandlerTag Source # | |
Defined in System.Wlog.LogHandler (==) :: LogHandlerTag -> LogHandlerTag -> Bool # (/=) :: LogHandlerTag -> LogHandlerTag -> Bool # | |
Show LogHandlerTag Source # | |
Defined in System.Wlog.LogHandler showsPrec :: Int -> LogHandlerTag -> ShowS # show :: LogHandlerTag -> String # showList :: [LogHandlerTag] -> ShowS # |
class LogHandler a where Source #
This is the base class for the various log handlers. They should all adhere to this class.
getTag :: a -> LogHandlerTag Source #
Tag of handler. Is arbitrary. Made for identification.
setLevel :: a -> Severities -> a Source #
Sets the log level. handle
will drop items beneath this
level.
getLevel :: a -> Severities Source #
Gets the current level.
setFormatter :: a -> LogFormatter a -> a Source #
Set a log formatter to customize the log format for this Handler
getFormatter :: a -> LogFormatter a Source #
emit :: MonadIO m => a -> Builder -> Text -> m () Source #
Forces an event to be logged regardless of the configured level.
readBack :: MonadIO m => a -> Int -> m [Text] Source #
Read back from logger (e.g. file), newest first. You specify
the number of (newest) logging entries. Logger can return pure
[]
if this behaviour can't be emulated or store buffer.
close :: MonadIO m => a -> m () Source #
Closes the logging system, causing it to close any open files, etc.
Instances
logHandlerMessage :: (MonadIO m, LogHandler a) => a -> LogRecord -> LoggerName -> m () Source #
Logs an event if it meets the requirements
given by the most recent call to setLevel
.