From 9b15071f23996ade3cb4823f17dba389c9a58e24 Mon Sep 17 00:00:00 2001 From: Joe Nelson Date: Fri, 27 Feb 2015 23:03:34 -0800 Subject: [PATCH] Log requests Fixes #141 --- CHANGELOG.md | 4 ++++ src/Main.hs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5611c4bc..93a43938e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## Unreleased +### Added +- Server response logging + ## [0.2.6.0] - 2015-02-18 ### Added - A changelog diff --git a/src/Main.hs b/src/Main.hs index ca0739499..3d65693c8 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -14,6 +14,7 @@ import Network.Wai.Middleware.Cors (cors) import Network.Wai.Handler.Warp hiding (Connection) import Network.Wai.Middleware.Gzip (gzip, def) import Network.Wai.Middleware.Static (staticPolicy, only) +import Network.Wai.Middleware.RequestLogger (logStdout) import Data.List (intercalate) import Data.Version (versionBranch) import qualified Hasql as H @@ -47,8 +48,8 @@ main = do appSettings = setPort port . setServerName (cs $ "postgrest/" <> prettyVersion) $ defaultSettings - middle = - (if configSecure conf then redirectInsecure else id) + middle = logStdout + . (if configSecure conf then redirectInsecure else id) . gzip def . cors corsPolicy . staticPolicy (only [("favicon.ico", "static/favicon.ico")]) anonRole = cs $ configAnonRole conf