wai-logger-0.3.1: A logging system for WAI

Safe Haskell | None

Network.Wai.Logger

Description

Logging system for WAI applications.

Sample code:

     {-# LANGUAGE OverloadedStrings #-}
     module Main where

     import Blaze.ByteString.Builder (fromByteString)
     import Control.Monad.IO.Class (liftIO)
     import Data.ByteString.Char8
     import Network.HTTP.Types (status200)
     import Network.Wai
     import Network.Wai.Handler.Warp
     import Network.Wai.Logger

     main :: IO ()
     main = do
         aplogger <- stdoutApacheLoggerInit FromSocket True
         run 3000 $ logapp aplogger

     logapp :: ApacheLogger -> Application
     logapp aplogger req = do
         let status = status200
             len = 4
         liftIO $ aplogger req status (Just len)
         return $ ResponseBuilder status
             [("Content-Type", "text/plain")
             ,("Content-Length", pack (show len))]
             $ fromByteString "PONG"

Synopsis

- type ApacheLogger = Request -> Status -> Maybe Integer -> IO ()
- stdoutApacheLoggerInit :: IPAddrSource -> Bool -> IO ApacheLogger
- stdoutApacheLoggerInit2 :: IPAddrSource -> Bool -> (DateCacheGetter, DateCacheCloser) -> IO ApacheLogger
- module Network.Wai.Logger.Format
- module Network.Wai.Logger.Utils

# Documentation

type ApacheLogger = Request -> Status -> Maybe Integer -> IO ()Source

Apache style logger for WAI

stdoutApacheLoggerInit Source

Arguments

:: IPAddrSource |
-> Bool | Automatically flush on each logging?
-> IO ApacheLogger |

Obtaining Apache style logger to stdout

stdoutApacheLoggerInit2 Source

Arguments

:: IPAddrSource |
-> Bool | Automatically flush on each logging?
-> (DateCacheGetter, DateCacheCloser) |
-> IO ApacheLogger |

Obtaining Apache style logger to stdout

module Network.Wai.Logger.Format

module Network.Wai.Logger.Utils