From 7f12f0116e4ec671af4c47276e7123470217e1cd Mon Sep 17 00:00:00 2001 From: nek0 Date: Tue, 16 Apr 2019 13:30:16 +0200 Subject: [PATCH] make logs --- mateamt.cabal | 2 ++ src/Main.hs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mateamt.cabal b/mateamt.cabal index 71c76e7..b3b6c7a 100644 --- a/mateamt.cabal +++ b/mateamt.cabal @@ -33,6 +33,8 @@ executable mateamt , product-profunctors , postgresql-simple , warp + , wai + , wai-logger , http-api-data hs-source-dirs: src default-language: Haskell2010 diff --git a/src/Main.hs b/src/Main.hs index a4b55e6..27fd50e 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -7,6 +7,8 @@ import Data.Time.Clock import Database.PostgreSQL.Simple +import Network.Wai +import Network.Wai.Logger import Network.Wai.Handler.Warp import Opaleye @@ -27,7 +29,9 @@ main = do conn <- connectPostgreSQL "host='localhost' port=5432 dbname='mateamt' user='mateamt' password='mateamt'" execute_ conn initUser - run 3000 (app conn) + withStdoutLogger $ \log -> do + let settings = setPort 3000 $ setLogger log defaultSettings + runSettings settings (app conn) app :: Connection -> Application app conn = serve userApi (users conn)