snap-server-0.4.0.1: A fast, iteratee-based, epoll-enabled web server for the Snap Framework

System.FastLogger

Synopsis

Documentation

data Logger Source

Holds the state for a logger.

timestampedLogEntry :: ByteString -> IO ByteStringSource

Prepares a log message with the time prepended.

combinedLogEntrySource

Arguments

:: ByteString

remote host

-> Maybe ByteString

remote user

-> ByteString

request line (up to you to ensure there are no quotes in here)

-> Int

status code

-> Maybe Int64

num bytes sent

-> Maybe ByteString

referer (up to you to ensure there are no quotes in here)

-> ByteString

user agent (up to you to ensure there are no quotes in here)

-> IO ByteString 

Prepares a log message in "combined" format.

newLogger :: FilePath -> IO LoggerSource

Creates a new logger, logging to the given file. If the file argument is "-", then log to stdout; if it's "stderr" then we log to stderr, otherwise we log to a regular file in append mode. The file is closed and re-opened every 15 minutes to facilitate external log rotation.

logMsg :: Logger -> ByteString -> IO ()Source

Sends out a log message verbatim with a newline appended. Note: if you want a fancy log message you'll have to format it yourself (or use combinedLogEntry).

stopLogger :: Logger -> IO ()Source

Kills a logger thread, causing any unwritten contents to be flushed out to disk