Skip to content

Commit 3828397

Browse files
authored
Fix json logging redirection predicate (#3832)
Previously, the logging filter would always enable JSON logs, even without `-l SimplifyJson`.
1 parent 28f515b commit 3828397

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

booster/tools/booster/Server.hs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ main = do
145145
monadLogger <- askLoggerIO
146146

147147
koreLogEntriesAsJsonSelector <-
148-
case Map.lookup (Logger.LevelOther "SimplifyJson") logLevelToKoreLogEntryMap of
149-
Nothing -> do
150-
Logger.logWarnNS
151-
"proxy"
152-
"Could not find out which Kore log entries correspond to the SimplifyJson level"
153-
pure (const False)
154-
Just es -> pure (`elem` es)
148+
if Logger.LevelOther "SimplifyJson" `elem` customLevels
149+
then case Map.lookup (Logger.LevelOther "SimplifyJson") logLevelToKoreLogEntryMap of
150+
Nothing -> do
151+
Logger.logWarnNS
152+
"proxy"
153+
"Could not find out which Kore log entries correspond to the SimplifyJson level"
154+
pure (const False)
155+
Just koreSimplificationLogEntries -> pure (`elem` koreSimplificationLogEntries)
156+
else pure (const False)
155157

156158
liftIO $ void $ withBugReport (ExeName "kore-rpc-booster") BugReportOnError $ \_reportDirectory -> withMDLib llvmLibraryFile $ \mdl -> do
157159
let coLogLevel = fromMaybe Log.Info $ toSeverity logLevel

dev-tools/kore-rpc-dev/Server.hs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,15 @@ main = do
157157
monadLogger <- askLoggerIO
158158

159159
koreLogEntriesAsJsonSelector <-
160-
case Map.lookup (Logger.LevelOther "SimplifyJson") logLevelToKoreLogEntryMap of
161-
Nothing -> do
162-
Logger.logWarnNS
163-
"proxy"
164-
"Could not find out which Kore log entries correspond to the SimplifyJson level"
165-
pure (const False)
166-
Just es -> pure (`elem` es)
160+
if Logger.LevelOther "SimplifyJson" `elem` customLevels
161+
then case Map.lookup (Logger.LevelOther "SimplifyJson") logLevelToKoreLogEntryMap of
162+
Nothing -> do
163+
Logger.logWarnNS
164+
"proxy"
165+
"Could not find out which Kore log entries correspond to the SimplifyJson level"
166+
pure (const False)
167+
Just koreSimplificationLogEntries -> pure (`elem` koreSimplificationLogEntries)
168+
else pure (const False)
167169

168170
let coLogLevel = fromMaybe Log.Info $ toSeverity logLevel
169171
koreLogOptions =

0 commit comments

Comments
 (0)