Permalink
Browse files

Use defaultMainLog

  • Loading branch information...
1 parent 4605255 commit ec93cbf4a64d0d4905db2cf58f506a871fed2e0a @snoyberg snoyberg committed Feb 5, 2014
Showing with 7 additions and 6 deletions.
  1. +4 −3 Application.hs
  2. +1 −1 PROJECTNAME.cabal
  3. +2 −2 app/main.hs
View
@@ -38,7 +38,7 @@ mkYesodDispatch "App" resourcesApp
-- performs initialization and creates a WAI application. This is also the
-- place to put your migrate statements to have automatic database
-- migrations handled by Yesod.
-makeApplication :: AppConfig DefaultEnv Extra -> IO Application
+makeApplication :: AppConfig DefaultEnv Extra -> IO (Application, LogFunc)
makeApplication conf = do
foundation <- makeFoundation conf
@@ -53,7 +53,8 @@ makeApplication conf = do
-- Create the WAI application and apply middlewares
app <- toWaiAppPlain foundation
- return $ logWare app
+ let logFunc = messageLoggerSource foundation (appLogger foundation)
+ return (logWare app, logFunc)
-- | Loads up any necessary settings, creates your foundation datatype, and
-- performs some initialization.
@@ -92,7 +93,7 @@ makeFoundation conf = do
-- for yesod devel
getApplicationDev :: IO (Int, Application)
getApplicationDev =
- defaultDevelApp loader makeApplication
+ defaultDevelApp loader (fmap fst . makeApplication)
where
loader = Yesod.Default.Config.loadConfig (configSettings Development)
{ csParseExtra = parseExtra
View
@@ -42,7 +42,7 @@ library
DeriveDataTypeable
build-depends: base >= 4 && < 5
- , yesod >= 1.2 && < 1.3
+ , yesod >= 1.2.5 && < 1.3
, yesod-core >= 1.2 && < 1.3
, yesod-auth >= 1.2 && < 1.3
, yesod-static >= 1.2 && < 1.3
View
@@ -1,8 +1,8 @@
import Prelude (IO)
import Yesod.Default.Config (fromArgs)
-import Yesod.Default.Main (defaultMain)
+import Yesod.Default.Main (defaultMainLog)
import Settings (parseExtra)
import Application (makeApplication)
main :: IO ()
-main = defaultMain (fromArgs parseExtra) makeApplication
+main = defaultMainLog (fromArgs parseExtra) makeApplication

0 comments on commit ec93cbf

Please sign in to comment.