From 81f267243ea467e301a1145cc4aa2500f7a9af2f Mon Sep 17 00:00:00 2001 From: soulomoon Date: Wed, 17 Apr 2024 02:25:58 +0800 Subject: [PATCH] enable ThreadId for when testing (#4174) enable ThreadId for when testing --------- Co-authored-by: fendor --- hls-plugin-api/src/Ide/Logger.hs | 1 + hls-test-utils/src/Test/Hls.hs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hls-plugin-api/src/Ide/Logger.hs b/hls-plugin-api/src/Ide/Logger.hs index 0a6cb5237f..2e3d0ba3c8 100644 --- a/hls-plugin-api/src/Ide/Logger.hs +++ b/hls-plugin-api/src/Ide/Logger.hs @@ -27,6 +27,7 @@ module Ide.Logger , module PrettyPrinterModule , renderStrict , toCologActionWithPrio + , defaultLoggingColumns ) where import Colog.Core (LogAction (..), Severity, diff --git a/hls-test-utils/src/Test/Hls.hs b/hls-test-utils/src/Test/Hls.hs index 9c4c33cad2..25f0f1d702 100644 --- a/hls-test-utils/src/Test/Hls.hs +++ b/hls-test-utils/src/Test/Hls.hs @@ -80,7 +80,7 @@ import Data.Proxy (Proxy (Proxy)) import qualified Data.Text as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TL -import Development.IDE (IdeState) +import Development.IDE (IdeState, LoggingColumn (ThreadIdColumn)) import Development.IDE.Main hiding (Log) import qualified Development.IDE.Main as Ghcide import qualified Development.IDE.Main as IDEMain @@ -94,6 +94,7 @@ import Ide.Logger (Pretty (pretty), Priority (..), Recorder, WithPriority (WithPriority, priority), cfilter, cmapWithPrio, + defaultLoggingColumns, logWith, makeDefaultStderrRecorder, (<+>)) @@ -348,7 +349,7 @@ pluginTestRecorder = do -- See 'runSessionWithServer'' for details. initialiseTestRecorder :: Pretty a => [String] -> IO (Recorder (WithPriority a)) initialiseTestRecorder envVars = do - docWithPriorityRecorder <- makeDefaultStderrRecorder Nothing + docWithPriorityRecorder <- makeDefaultStderrRecorder (Just $ ThreadIdColumn : defaultLoggingColumns) -- There are potentially multiple environment variables that enable this logger definedEnvVars <- forM envVars (\var -> fromMaybe "0" <$> lookupEnv var) let logStdErr = any (/= "0") definedEnvVars