Safe Haskell | None |
---|---|
Language | Haskell2010 |
Various combinators for composing "monad-logger" loggers.
Synopsis
- standardLogging :: LogLevel -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- withStandardFormat :: LogLevel -> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- withTime :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- withThread :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- withLevel :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- withPrefix :: LogStr -> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- withPackage :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- filterLogging :: (Loc -> LogSource -> LogLevel -> LogStr -> Bool) -> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- levelFilter :: LogLevel -> Loc -> LogSource -> LogLevel -> LogStr -> Bool
- teeLogging :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- stdoutLogging :: Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- fdLogging :: Handle -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()
- parseLevel :: Text -> LogLevel
- newtype JSONLevel = JSONLevel {}
Standard OM logging
standardLogging :: LogLevel -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #
The standard logging for most OM programs.
:: LogLevel | The minimum log level that will be logged. |
-> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) | The base logger. |
-> Loc | |
-> LogSource | |
-> LogLevel | |
-> LogStr | |
-> IO () |
Log to the indicated destination, applying the "standard" filters and formats.
Logging Combinators
withTime :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #
Add timing information to the beginning of logs.
withThread :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #
Prepend the ThreadId
to the beginning of the log.
withLevel :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #
Add the Logging level to the log output.
withPrefix :: LogStr -> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #
Prefix a fixed string to the log output.
withPackage :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #
Add the originating package to the log message.
Filters
:: (Loc -> LogSource -> LogLevel -> LogStr -> Bool) | The filter to apply. |
-> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) | The downstream logging destination. |
-> Loc | |
-> LogSource | |
-> LogLevel | |
-> LogStr | |
-> IO () |
Filter out some log messages. Only messages matching the predicate are logged to the underlying logger.
levelFilter :: LogLevel -> Loc -> LogSource -> LogLevel -> LogStr -> Bool Source #
levelFilter level
is a filter predicate that matches all log messages
with level
or above.
Destinations
:: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) | Destination 1. |
-> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) | Destination 2. |
-> Loc | |
-> LogSource | |
-> LogLevel | |
-> LogStr | |
-> IO () |
Log to more than one logging destination.
stdoutLogging :: Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #
Log messages to stdout. This is very bare bones. It only logs the
message itself with no other information. It is meant to be used in
conjunction with some of the other combinators, like withLevel
.
fdLogging :: Handle -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #
Like stdoutLogging
, but log to a file handle.
Other types
parseLevel :: Text -> LogLevel Source #
Parse a logging level from a string.