Add access logging
This commit is contained in:
parent
746ca6a507
commit
c69ef215b5
3 changed files with 7 additions and 1 deletions
|
@ -23,6 +23,7 @@ dependencies:
|
||||||
- aeson
|
- aeson
|
||||||
- servant-server
|
- servant-server
|
||||||
- wai
|
- wai
|
||||||
|
- wai-logger
|
||||||
- warp
|
- warp
|
||||||
|
|
||||||
library:
|
library:
|
||||||
|
|
|
@ -12,6 +12,7 @@ import Data.Aeson
|
||||||
import Data.Aeson.TH
|
import Data.Aeson.TH
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Network.Wai.Handler.Warp
|
import Network.Wai.Handler.Warp
|
||||||
|
import Network.Wai.Logger
|
||||||
import Servant
|
import Servant
|
||||||
|
|
||||||
data Prices = Prices
|
data Prices = Prices
|
||||||
|
@ -44,7 +45,8 @@ type API =
|
||||||
:<|> Raw
|
:<|> Raw
|
||||||
|
|
||||||
startApp :: IO ()
|
startApp :: IO ()
|
||||||
startApp = run 8080 app
|
startApp = withStdoutLogger $ \logger ->
|
||||||
|
runSettings (setPort 8080 $ setLogger logger $ defaultSettings) app
|
||||||
|
|
||||||
app :: Application
|
app :: Application
|
||||||
app = serve api server
|
app = serve api server
|
||||||
|
|
|
@ -33,6 +33,7 @@ library
|
||||||
, base >=4.7 && <5
|
, base >=4.7 && <5
|
||||||
, servant-server
|
, servant-server
|
||||||
, wai
|
, wai
|
||||||
|
, wai-logger
|
||||||
, warp
|
, warp
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ executable tutor-exe
|
||||||
, servant-server
|
, servant-server
|
||||||
, tutor
|
, tutor
|
||||||
, wai
|
, wai
|
||||||
|
, wai-logger
|
||||||
, warp
|
, warp
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
@ -69,5 +71,6 @@ test-suite tutor-test
|
||||||
, servant-server
|
, servant-server
|
||||||
, tutor
|
, tutor
|
||||||
, wai
|
, wai
|
||||||
|
, wai-logger
|
||||||
, warp
|
, warp
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
Loading…
Reference in a new issue