hslogger-reader-1.0.1: Parsing hslogger-produced logs.

Safe HaskellSafe
LanguageHaskell2010

System.Log.Reader

Contents

Description

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.

Synopsis

Documentation

logMessageParser Source

Arguments

:: 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.

tfLogMessageParser Source

Arguments

:: 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.