chore(debug): crop settings debug output

This commit is contained in:
Steffen Jost 2022-09-23 12:37:10 +02:00
parent f31e509212
commit a78cf6c301
3 changed files with 13 additions and 15 deletions

View File

@ -252,7 +252,7 @@ makeFoundation appSettings''@AppSettings{..} = do
runAppLoggingT tempFoundation $ do
$logInfoS "InstanceID" $ UUID.toText appInstanceID
$logDebugS "Configuration" $ tshowShort appSettings''
$logDebugS "Configuration" $ tshowCrop appSettings''
$logDebugS "RTSFlags" . tshow =<< liftIO getRTSFlags
smtpPool <- for appSmtpConf $ \c -> do
@ -366,7 +366,7 @@ makeFoundation appSettings''@AppSettings{..} = do
}
return . Just $ mkAvsQuery avsServer avsAuth avsEnv
$logDebugS "Runtime configuration" $ tshowShort appSettings'
$logDebugS "Runtime configuration" $ tshowCrop appSettings'
let foundation = mkFoundation appSettings' sqlPool smtpPool ldapPool appCryptoIDKey appSessionStore appSecretBoxKey appWidgetMemcached appJSONWebKeySet appClusterID appMemcached appMemcachedLocal appUploadCache appVerpSecret appAuthKey appPersonalisedSheetFilesSeedKey appVolatileClusterSettingsCache appAvsQuery

View File

@ -208,7 +208,6 @@ data AppSettings = AppSettings
, appCheckMissingFiles :: Maybe NominalDiffTime
, appFileUploadDBChunksize :: Int
, appFileChunkingParams :: FastCDCParameters
, appFavouritesQuickActionsBurstsize
, appFavouritesQuickActionsAvgInverseRate :: Word64
@ -241,18 +240,11 @@ data AppSettings = AppSettings
, appJobMaxFlush :: Maybe Natural
, appCommunicationAttachmentsMaxSize :: Maybe Natural
, appFileChunkingParams :: FastCDCParameters
} deriving Show
-- | Some settings strech for multiple lines
tshowShort :: AppSettings -> Text
tshowShort a = Text.take 256 $ tshow a' -- TODO: show only one line!
where a' = a {
appFileChunkingParams = afcp { fastCDCGearHashTable = error "emptyarray" }
}
afcp = appFileChunkingParams a
-- fcght = fastCDCGearHashTable afcp
data JobMode = JobsLocal { jobsAcceptOffload :: Bool }
| JobsOffload

View File

@ -277,8 +277,10 @@ stripAll = Text.filter (not . isSpace)
-- | take first line, only
cropText :: Text -> Text
cropText (Text.lines -> l:_) = Text.take 80 l
cropText t = Text.take 80 t
cropText (Text.take 255 -> t) = headDef t $ Text.lines t
tshowCrop :: Show a => a -> Text
tshowCrop = cropText . tshow
-- | strip leading and trailing whitespace and make case insensitive
-- also helps to avoid the need to import just for CI.mk
@ -574,6 +576,10 @@ mTuple = liftA2 (,)
-- notNull = not . null
headDef :: a -> [a] -> a
headDef _ (h:_) = h
headDef d _ = d
lastMaybe :: [a] -> Maybe a
lastMaybe [] = Nothing
lastMaybe [h] = Just h