From a78cf6c301f712f5c754e0cfc4486fef2c25a3dc Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Fri, 23 Sep 2022 12:37:10 +0200 Subject: [PATCH] chore(debug): crop settings debug output --- src/Application.hs | 4 ++-- src/Settings.hs | 14 +++----------- src/Utils.hs | 10 ++++++++-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/Application.hs b/src/Application.hs index b34347390..0b67152d6 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -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 diff --git a/src/Settings.hs b/src/Settings.hs index 4ff3c29e3..f5bf42643 100644 --- a/src/Settings.hs +++ b/src/Settings.hs @@ -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 diff --git a/src/Utils.hs b/src/Utils.hs index 7b29b7704..c3043de6e 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -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