From 19f13fa3c714df7fcda5f7679a1cc05e6c39eaf9 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 4 Dec 2013 07:00:28 +0200 Subject: [PATCH] Scaffolding update --- yesod-bin/hsfiles/mongo.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/mysql.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/postgres-fay.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/postgres.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/simple.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/sqlite.hsfiles | 35 +++++++++++++++++--------- 6 files changed, 138 insertions(+), 72 deletions(-) diff --git a/yesod-bin/hsfiles/mongo.hsfiles b/yesod-bin/hsfiles/mongo.hsfiles index e3055394..ef8463b4 100644 --- a/yesod-bin/hsfiles/mongo.hsfiles +++ b/yesod-bin/hsfiles/mongo.hsfiles @@ -30,10 +30,16 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist -import Network.HTTP.Conduit (newManager, def) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -58,7 +64,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -69,14 +75,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/mongoDB.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf logger return foundation @@ -110,7 +120,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -395,16 +405,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/mysql.hsfiles b/yesod-bin/hsfiles/mysql.hsfiles index 2657e63e..c24c6055 100644 --- a/yesod-bin/hsfiles/mysql.hsfiles +++ b/yesod-bin/hsfiles/mysql.hsfiles @@ -30,12 +30,18 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist import Database.Persist.Sql (runMigration) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) import Control.Monad.Logger (runLoggingT) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -60,7 +66,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -71,14 +77,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/mysql.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf logger -- Perform database migration using our application's logging settings. runLoggingT @@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -399,16 +409,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/postgres-fay.hsfiles b/yesod-bin/hsfiles/postgres-fay.hsfiles index ded715f0..543559b8 100644 --- a/yesod-bin/hsfiles/postgres-fay.hsfiles +++ b/yesod-bin/hsfiles/postgres-fay.hsfiles @@ -31,13 +31,19 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist import Database.Persist.Sql (runMigration) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) import Yesod.Fay (getFaySite) import Control.Monad.Logger (runLoggingT) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -63,7 +69,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -74,14 +80,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf onCommand logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf onCommand logger -- Perform database migration using our application's logging settings. runLoggingT @@ -120,7 +130,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Hamlet (hamletFile) import Yesod.Fay -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -436,16 +446,17 @@ library , shakespeare-js >= 1.2 && < 1.3 , shakespeare-text >= 1.0 && < 1.1 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/postgres.hsfiles b/yesod-bin/hsfiles/postgres.hsfiles index 9aef1ae3..32a9e2f5 100644 --- a/yesod-bin/hsfiles/postgres.hsfiles +++ b/yesod-bin/hsfiles/postgres.hsfiles @@ -30,12 +30,18 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist import Database.Persist.Sql (runMigration) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) import Control.Monad.Logger (runLoggingT) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -60,7 +66,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -71,14 +77,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf logger -- Perform database migration using our application's logging settings. runLoggingT @@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -399,16 +409,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/simple.hsfiles b/yesod-bin/hsfiles/simple.hsfiles index 73fc703c..2617e814 100644 --- a/yesod-bin/hsfiles/simple.hsfiles +++ b/yesod-bin/hsfiles/simple.hsfiles @@ -28,9 +28,15 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger -import Network.HTTP.Conduit (newManager, def) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger +import Network.HTTP.Conduit (newManager, conduitManagerSettings) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -55,7 +61,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -66,10 +72,14 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite - logger <- mkLogger True stdout - let foundation = App conf s manager logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s manager logger return foundation @@ -97,7 +107,7 @@ import Settings.StaticFiles import Settings (widgetFile, Extra (..)) import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -326,16 +336,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/sqlite.hsfiles b/yesod-bin/hsfiles/sqlite.hsfiles index 9b7ca111..252dc12c 100644 --- a/yesod-bin/hsfiles/sqlite.hsfiles +++ b/yesod-bin/hsfiles/sqlite.hsfiles @@ -30,12 +30,18 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist import Database.Persist.Sql (runMigration) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) import Control.Monad.Logger (runLoggingT) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -60,7 +66,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -71,14 +77,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf logger -- Perform database migration using our application's logging settings. runLoggingT @@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -399,16 +409,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only)