summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-11-06 15:06:28 +0100
committertv <tv@shackspace.de>2014-11-06 15:06:28 +0100
commit781e26234dd1854c51895fa4fcc31f26f209c52f (patch)
tree10972bc1452b49d8b746f4d0e1b503b337b6f948 /src
parentbdc4373e93cce1f079cc08eb01689911c6dd6d59 (diff)
Log requests to stdout.
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs13
-rw-r--r--src/Main/Config.hs1
2 files changed, 10 insertions, 4 deletions
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
-- |