Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Generate a parser for logs produced by the hslogger package, supporting arbitrary formatting strings (see System.Log.Formatter). Currently, this package does not provide support for custom-defined formatters.
logMessageParser
will generate a parser for a LogMessage
given
a format string (such "[$utcTime $loggername $prio] $msg"
) and
a parser for your logger names. This can then be used to read logs
line-by-line, potentially in constant memory, from disk. See the
accompanying executable for an example of this.
- data LogMessage = LogMessage {}
- type FormatString = Text
- logMessageParser :: FormatString -> Parser Text -> Either String (Parser LogMessage)
- tfLogMessageParser :: FormatString -> Parser Text -> Parser ZonedTime -> Either String (Parser LogMessage)
- zonedTimeParser :: Parser ZonedTime
Documentation
type FormatString = Text Source
:: FormatString | |
-> Parser Text | LoggerName parser |
-> Either String (Parser LogMessage) |
Build a parser for a LogMessage
from a format string, as
described by the hslogger package.
:: FormatString | |
-> Parser Text | LoggerName parser |
-> Parser ZonedTime | Time parser |
-> Either String (Parser LogMessage) |
As logMessageParser
, but provide a custom time format for
parsing "$time"
and "$utcTime"
formatters. Compatible with
hslogger's tfLogFormatter function.
Extras
zonedTimeParser :: Parser ZonedTime Source
Parse time format string "%F %X %Z"
with defaultTimeLocale
.