From 781e26234dd1854c51895fa4fcc31f26f209c52f Mon Sep 17 00:00:00 2001
From: tv <tv@shackspace.de>
Date: Thu, 6 Nov 2014 15:06:28 +0100
Subject: Log requests to stdout.

---
 src/Main.hs        | 13 +++++++++----
 src/Main/Config.hs |  1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/Main.hs b/src/Main.hs
index a2755e0..ef7710f 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -48,10 +48,12 @@ import Data.Attoparsec.ByteString.Char8 (decimal, endOfInput, parseOnly)
 import qualified Data.ByteString.Char8 as BS8
 import qualified Data.ByteString.Lazy as LBS
 import Data.List (isInfixOf)
+import Data.Monoid
 import Main.Config
 import Main.Util
-import Network.Wai.Handler.Warp (run)
 import Network.Wai
+import Network.Wai.Handler.Warp (run)
+import Network.Wai.Middleware.RequestLogger (logStdout)
 import System.FilePath
 import System.IO.Error
 
@@ -75,9 +77,12 @@ main =
 
 -- | Run the application with the given configuration.
 start :: Config -> IO ()
-start c =
-    run (httpPort c) $ \req ->
-        resourceHandler (requestResource c req) req
+start c = do
+    putStrLn $ "run cgserver with " <> show c
+    run (httpPort c)
+        $ logStdout
+        $ \req ->
+            resourceHandler (requestResource c req) req
 
 
 -- | Determine which request is requested.
diff --git a/src/Main/Config.hs b/src/Main/Config.hs
index 45fa50f..9639faa 100644
--- a/src/Main/Config.hs
+++ b/src/Main/Config.hs
@@ -22,6 +22,7 @@ data Config = Config
     { cgroupRoot :: FilePath
     , httpPort :: Port
     }
+  deriving Show
 
 
 -- |
-- 
cgit v1.2.3