fix: remove red herring warp logs on default log-level
The logs added on e95e815483 are red
herrings under normal operation.
This moves them to `log-level=debug` and removes "error" from the
message prefix.
Fixes https://github.com/PostgREST/postgrest/issues/4799
This commit is contained in:
committed by
Steve Chavez
parent
c31aeecdcf
commit
2fb2e86473
@@ -99,7 +99,7 @@ run appState = do
|
||||
onWarpException :: Maybe Wai.Request -> SomeException -> IO ()
|
||||
onWarpException _ ex =
|
||||
when (shouldDisplayException ex) $
|
||||
observer $ WarpErrorObs $ show ex
|
||||
observer $ WarpServerObs $ show ex
|
||||
|
||||
-- Similar to wai defaultShouldDisplayException in
|
||||
-- https://github.com/yesodweb/wai//blob/8c3882c60f6abe043889fc20c7efd3fa9747fa4a/warp/Network/Wai/Handler/Warp/Settings.hs#L251-L258
|
||||
|
||||
@@ -120,6 +120,9 @@ observationLogger loggerState logLevel obs = case obs of
|
||||
o@(JwtCacheLookup _) ->
|
||||
when (logLevel >= LogDebug) $ do
|
||||
logWithZTime loggerState $ observationMessages o
|
||||
o@(WarpServerObs _) ->
|
||||
when (logLevel >= LogDebug) $ do
|
||||
logWithZTime loggerState $ observationMessages o
|
||||
o ->
|
||||
logWithZTime loggerState $ observationMessages o
|
||||
|
||||
@@ -235,8 +238,8 @@ observationMessages = \case
|
||||
pure "Evicted entry from JWT cache"
|
||||
TerminationUnixSignalObs signal ->
|
||||
pure $ "Received termination unix signal " <> signal
|
||||
WarpErrorObs txt ->
|
||||
pure $ "Warp server error: " <> txt
|
||||
WarpServerObs txt ->
|
||||
pure $ "Warp server: " <> txt
|
||||
where
|
||||
showMillis :: Double -> Text
|
||||
showMillis x = toS $ showFFloat (Just 1) x ""
|
||||
|
||||
@@ -57,7 +57,7 @@ data Observation
|
||||
| JwtCacheLookup Bool
|
||||
| JwtCacheEviction
|
||||
| TerminationUnixSignalObs Text
|
||||
| WarpErrorObs Text
|
||||
| WarpServerObs Text
|
||||
deriving (Generic)
|
||||
|
||||
data ObsFatalError = ServerAuthError | ServerPgrstBug | ServerError42P05 | ServerError08P01
|
||||
|
||||
Reference in New Issue
Block a user