Add log-level config

This commit is contained in:
steve-chavez
2020-10-06 14:21:46 -05:00
committed by Steve Chavez
parent 60398ad538
commit e9efcc70a5
8 changed files with 34 additions and 18 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ import Test.Hspec
import PostgREST.App (postgrest)
import PostgREST.Config (AppConfig (..))
import PostgREST.DbStructure (getDbStructure, getPgVersion)
import PostgREST.Types (LogSetup (..), pgVersion95, pgVersion96)
import PostgREST.Types (LogLevel (..), pgVersion95, pgVersion96)
import Protolude hiding (toList, toS)
import Protolude.Conv (toS)
import SpecHelper
@@ -67,13 +67,13 @@ main = do
-- For tests that run with the same refDbStructure
app cfg = do
refConf <- newIORef $ cfg testDbConn
return ((), postgrest LogQuiet refConf refDbStructure pool getTime $ pure ())
return ((), postgrest LogCrit refConf refDbStructure pool getTime $ pure ())
-- For tests that run with a different DbStructure(depends on configSchemas)
appDbs cfg = do
dbs <- (newIORef . Just) =<< setupDbStructure pool (configSchemas $ cfg testDbConn) actualPgVersion
refConf <- newIORef $ cfg testDbConn
return ((), postgrest LogQuiet refConf dbs pool getTime $ pure ())
return ((), postgrest LogCrit refConf dbs pool getTime $ pure ())
let withApp = app testCfg
maxRowsApp = app testMaxRowsCfg
+2 -1
View File
@@ -24,7 +24,7 @@ import Text.Heredoc
import PostgREST.Auth (parseSecret)
import PostgREST.Config (AppConfig (..))
import PostgREST.Types (JSPathExp (..))
import PostgREST.Types (JSPathExp (..), LogLevel (..))
import Protolude hiding (toS)
import Protolude.Conv (toS)
@@ -89,6 +89,7 @@ _baseCfg = let secret = Just $ encodeUtf8 "reallyreallyreallyreallyverysafe" in
, configRootSpec = Nothing
, configRawMediaTypes = []
, configJWKS = parseSecret <$> secret
, configLogLevel = LogCrit
}
testCfg :: Text -> AppConfig