trace-embrace 1.0.10 → 1.0.11
raw patch · 7 files changed
+23/−11 lines, 7 files
Files
- src/Debug/TraceEmbrace/Config/Load.hs +6/−6
- test/Debug/TraceEmbrace/Test/TraceEmbrace/Config.hs +10/−0
- test/Debug/TraceEmbrace/Test/TraceEmbrace/TH/Event.hs +2/−0
- test/Debug/TraceEmbrace/Test/TraceEmbrace/TH/Format/Lifted.hs +0/−4
- test/Debug/TraceEmbrace/Test/TraceEmbrace/TH/Format/Unboxed.hs +2/−0
- test/Debug/TraceEmbrace/Test/TraceEmbrace/TH/Threshold.hs +2/−0
- trace-embrace.cabal +1/−1
src/Debug/TraceEmbrace/Config/Load.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} module Debug.TraceEmbrace.Config.Load where -import Control.Concurrent.MVar+import Control.Concurrent import Control.Exception import Data.Cache.LRU as LRU import Data.Char@@ -82,8 +82,7 @@ loadYamlConfig :: IO YamlConfig loadYamlConfig = do doesFileExist fp >>= \case- True -> do- putStrLn $ "Loading existish trace-embrace config from [" <> fp <> "]"+ True -> configFromJust . (<> defaultYamlConfig) =<< catch (Y.decodeFileThrow fp) badYaml False -> do catch (do@@ -137,7 +136,9 @@ getConfig :: Q TraceEmbraceConfig getConfig = do c <- runIO readConfigRef >>= loadIfNothing- addDependentFile traceEmbraceConfigFileName+ runIO (doesFileExist traceEmbraceConfigFileName) >>= \case+ True -> addDependentFile traceEmbraceConfigFileName+ False -> reportWarning $ "Config File is missing - skip dependency" pure c where readConfigRef = readIORef traceEmbraceConfigRef@@ -147,8 +148,7 @@ (putMVar configReadToken) (\() -> readConfigRef >>= \case- Just c -> do- putStrLn "trace-embrace.yaml Config is already loaded after resume"+ Just c -> pure c Nothing -> do c <- yaml2Config <$> loadYamlConfig
test/Debug/TraceEmbrace/Test/TraceEmbrace/Config.hs view
@@ -17,6 +17,7 @@ import System.IO import System.IO.Temp + positionOnly :: TraceMessageFormat positionOnly = defaultTraceMessageFormat@@ -65,10 +66,19 @@ Right r -> r Left e -> error e +-- | Always call 'resetConfig' at the end of module using 'setConfig'. setConfig :: TraceEmbraceConfig -> Q () setConfig c = runIO (do closeUnsafeIoSink atomicWriteIORef traceEmbraceConfigRef (Just c))++-- | Every module using 'setConfig' should call at the end+-- 'resetConfig' because setConfig does not create real file.+resetConfig :: Q [Dec]+resetConfig = do+ runIO (do closeUnsafeIoSink+ atomicWriteIORef traceEmbraceConfigRef Nothing)+ pure [] closeUnsafeIoSink :: IO () closeUnsafeIoSink = do
test/Debug/TraceEmbrace/Test/TraceEmbrace/TH/Event.hs view
@@ -60,3 +60,5 @@ go x = x @=? foo x where foo = $(trFunMarker poisonedId)++resetConfig
test/Debug/TraceEmbrace/Test/TraceEmbrace/TH/Format/Lifted.hs view
@@ -5,14 +5,10 @@ import Data.ByteString.Lazy import Debug.TraceEmbrace.Internal.TH import Debug.TraceEmbrace.Test.TraceEmbrace.Config-import Language.Haskell.TH.Lock import Test.Tasty.HUnit ((@=?)) -- not working: https://gitlab.haskell.org/ghc/ghc/-/issues/25775 default (Int)---ensureSerialCompilationVerbose unit_traceMessage_const :: IO () unit_traceMessage_const =
test/Debug/TraceEmbrace/Test/TraceEmbrace/TH/Format/Unboxed.hs view
@@ -64,3 +64,5 @@ where foo :: (# #) -> String foo t = $(trConstMsg "foo/t")++resetConfig
test/Debug/TraceEmbrace/Test/TraceEmbrace/TH/Threshold.hs view
@@ -64,3 +64,5 @@ withPrefixEnvVar thresholdConfig "-" $ do two @=? $(setConfig (thresholdConfig & #mode .~ TraceStd) >> I.tr [| \x -> x + 1 |] "tm") one++resetConfig
trace-embrace.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: trace-embrace-version: 1.0.10+version: 1.0.11 license: BSD-3-Clause license-file: LICENSE category: Development