monad-logger-aeson 0.3.0.1 → 0.3.0.2
raw patch · 30 files changed
+197/−201 lines, 30 filesdep ~aeson-diffdep ~basedep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson-diff, base, bytestring, directory, exceptions, fast-logger, monad-logger, text, time
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- app/readme-example.hs +1/−2
- library/Control/Monad/Logger/Aeson.hs +8/−6
- library/Control/Monad/Logger/Aeson/Internal.hs +25/−10
- monad-logger-aeson.cabal +17/−17
- package.yaml +17/−17
- test-suite/Test/Control/Monad/Logger/AesonSpec.hs +59/−60
- test-suite/TestCase.hs +2/−3
- test-suite/TestCase/LogDebug/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogDebug/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogDebugNS/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogDebugNS/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogError/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogError/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogErrorNS/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogErrorNS/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogInfo/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogInfo/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogInfoNS/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogInfoNS/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogOther/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogOther/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogOtherNS/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogOtherNS/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogWarn/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogWarn/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/LogWarnNS/MetadataNoThreadContextYes.hs +3/−4
- test-suite/TestCase/LogWarnNS/MetadataYesThreadContextYes.hs +3/−4
- test-suite/TestCase/MonadLogger/LogDebug/ThreadContextYes.hs +3/−4
- test-suite/TestCase/MonadLogger/LogDebugN/ThreadContextYes.hs +1/−2
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Change log +## 0.3.0.2++* Backwards compatibility down to GHC 8.4 (@pbrisbin)+ ## 0.3.0.1 * Minor Haddock updates
app/readme-example.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE OverloadedStrings #-} module Main ( main@@ -12,6 +11,6 @@ main :: IO () main = do- runStdoutLoggingT do+ runStdoutLoggingT $ do doStuff 42 logInfo "Done"
library/Control/Monad/Logger/Aeson.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE BlockArguments #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-}@@ -84,7 +84,9 @@ , runFileLoggingT , runStderrLoggingT , runStdoutLoggingT+#if MIN_VERSION_monad_logger(0,3,36) , defaultOutput+#endif , defaultLogStr ) @@ -240,7 +242,7 @@ -- @since 0.1.0.0 withThreadContext :: (MonadIO m, MonadMask m) => [Pair] -> m a -> m a withThreadContext pairs =- Context.adjust Internal.threadContextStore \pairsMap ->+ Context.adjust Internal.threadContextStore $ \pairsMap -> Internal.keyMapUnion (Internal.keyMapFromList pairs) pairsMap -- | This function lets us retrieve the calling thread's thread context. For@@ -264,7 +266,7 @@ -- @since 0.1.0.0 runFileLoggingT :: (MonadIO m, MonadMask m) => FilePath -> LoggingT m a -> m a runFileLoggingT filePath action =- Catch.bracket (liftIO $ openFile filePath AppendMode) (liftIO . hClose) \h -> do+ Catch.bracket (liftIO $ openFile filePath AppendMode) (liftIO . hClose) $ \h -> do liftIO $ hSetBuffering h LineBuffering runLoggingT action $ defaultOutput h @@ -355,7 +357,7 @@ defaultOutputWith outputOptions location logSource logLevel msg = do now <- Time.getCurrentTime threadIdText <- fmap (Text.pack . show) Concurrent.myThreadId- threadContext <- Context.mines Internal.threadContextStore \hashMap ->+ threadContext <- Context.mines Internal.threadContextStore $ \hashMap -> ( if outputIncludeThreadId then Internal.keyMapInsert "tid" $ String threadIdText else@@ -392,7 +394,7 @@ -> LogStr -> IO () handleOutput levelToHandle =- defaultOutputWith $ defaultOutputOptions \logLevel bytes -> do+ defaultOutputWith $ defaultOutputOptions $ \logLevel bytes -> do BS8.hPutStrLn (levelToHandle logLevel) bytes -- | An implementation of the action that backs the 'monadLoggerLog' function,@@ -416,7 +418,7 @@ -> LogStr -> IO () fastLoggerOutput loggerSet =- defaultOutputWith $ defaultOutputOptions \_logLevel bytes -> do+ defaultOutputWith $ defaultOutputOptions $ \_logLevel bytes -> do FastLogger.pushLogStrLn loggerSet $ toLogStr bytes -- | @since 0.1.0.0
library/Control/Monad/Logger/Aeson/Internal.hs view
@@ -1,7 +1,7 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE DerivingVia #-}+{-# LANGUAGE DerivingStrategies #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-}@@ -59,7 +59,6 @@ import Data.Time (UTCTime) import GHC.Generics (Generic) import GHC.Stack (SrcLoc(..), CallStack, getCallStack)-import System.Log.FastLogger.Internal (LogStr(..)) import qualified Context import qualified Control.Monad.Logger as Logger import qualified Data.Aeson as Aeson@@ -75,6 +74,12 @@ import qualified Data.Text.Encoding.Error as Text.Encoding.Error import qualified System.IO.Unsafe as IO.Unsafe +#if MIN_VERSION_fast_logger(3,0,1)+import System.Log.FastLogger.Internal (LogStr(..))+#else+import System.Log.FastLogger (LogStr, fromLogStr)+#endif+ #if MIN_VERSION_aeson(2, 0, 0) import Data.Aeson.Key (Key) import Data.Aeson.KeyMap (KeyMap)@@ -110,7 +115,7 @@ -- @since 0.3.0.0 newtype SeriesElem = UnsafeSeriesElem { unSeriesElem :: Series- } deriving (KeyValue) via Series+ } deriving newtype KeyValue -- | This type is the Haskell representation of each JSON log message produced -- by this library.@@ -131,7 +136,7 @@ } deriving stock (Eq, Generic, Ord, Show) instance FromJSON LoggedMessage where- parseJSON = Aeson.withObject "LoggedMessage" \obj -> do+ parseJSON = Aeson.withObject "LoggedMessage" $ \obj -> do loggedMessageTimestamp <- obj .: "time" loggedMessageLevel <- fmap logLevelFromText $ obj .: "level" loggedMessageLoc <- parseLoc =<< obj .:? "location"@@ -158,7 +163,7 @@ parseLoc :: Maybe Value -> Parser (Maybe Loc) parseLoc =- traverse $ Aeson.withObject "Loc" \obj ->+ traverse $ Aeson.withObject "Loc" $ \obj -> Loc <$> obj .: "file" <*> obj .: "package"@@ -169,11 +174,11 @@ parsePairs :: Maybe Value -> Parser (KeyMap Value) parsePairs = \case Nothing -> pure mempty- Just value -> flip (Aeson.withObject "[Pair]") value \obj -> do+ Just value -> flip (Aeson.withObject "[Pair]") value $ \obj -> do pure obj parseMessage :: Value -> Parser (Text, KeyMap Value)- parseMessage = Aeson.withObject "Message" \obj ->+ parseMessage = Aeson.withObject "Message" $ \obj -> (,) <$> obj .: "text" <*> (parsePairs =<< obj .:? "meta") instance ToJSON LoggedMessage where@@ -390,8 +395,18 @@ Text.Encoding.decodeUtf8With Text.Encoding.Error.lenientDecode . LBS.toStrict - logStrLBS = Builder.toLazyByteString logStrBuilder- LogStr _ logStrBuilder = logStr+ logStrLBS = logStrToLBS logStr++logStrToLBS :: LogStr -> LBS.ByteString+logStrToLBS =+#if MIN_VERSION_fast_logger(3,0,1)+ -- Use (presumably) faster/better conversion if we have new enough fast-logger+ Builder.toLazyByteString . unLogStr+ where+ unLogStr (LogStr _ builder) = builder+#else+ LBS.fromStrict . fromLogStr+#endif logCS :: (MonadLogger m)
monad-logger-aeson.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: monad-logger-aeson-version: 0.3.0.1+version: 0.3.0.2 synopsis: JSON logging using monad-logger interface description: @monad-logger-aeson@ provides structured JSON logging using @monad-logger@'s interface.@@ -42,14 +42,14 @@ ghc-options: -Wall -fwarn-tabs -Wincomplete-uni-patterns -Wredundant-constraints build-depends: aeson >=1.5.2.0 && <2.1.3.0- , base >=4.13.0.0 && <5- , bytestring >=0.10.10.1 && <0.12.0.0+ , base >=4.11.1.0 && <5+ , bytestring >=0.10.8.2 && <0.12.0.0 , context >=0.2.0.0 && <0.3- , exceptions >=0.10.4 && <0.11.0- , fast-logger >=3.0.2 && <3.2.0- , monad-logger >=0.3.36 && <0.4.0- , text >=1.2.4.0 && <1.3.0.0 || >=2.0 && <2.1- , time >=1.9.3 && <1.12.0.0+ , exceptions >=0.10.0 && <0.11.0+ , fast-logger >=2.4.11 && <3.2.0+ , monad-logger >=0.3.30 && <0.4.0+ , text >=1.2.3.1 && <1.3.0.0 || >=2.0 && <2.1+ , time >=1.8.0.2 && <1.12.0.0 , unordered-containers >=0.2.10.0 && <0.3.0.0 default-language: Haskell2010 @@ -62,10 +62,10 @@ ghc-options: -Wall -fwarn-tabs -Wincomplete-uni-patterns -Wredundant-constraints build-depends: aeson >=1.5.2.0 && <2.1.3.0- , base >=4.13.0.0 && <5- , monad-logger >=0.3.36 && <0.4.0+ , base >=4.11.1.0 && <5+ , monad-logger >=0.3.30 && <0.4.0 , monad-logger-aeson- , text >=1.2.4.0 && <1.3.0.0 || >=2.0 && <2.1+ , text >=1.2.3.1 && <1.3.0.0 || >=2.0 && <2.1 default-language: Haskell2010 test-suite monad-logger-aeson-test-suite@@ -126,12 +126,12 @@ hspec-discover:hspec-discover build-depends: aeson >=1.5.2.0 && <2.1.3.0- , aeson-diff >=1.1.0.9 && <1.2.0.0- , base >=4.13.0.0 && <5- , bytestring >=0.10.10.1 && <0.12.0.0- , directory >=1.3.6.0 && <1.4.0.0+ , aeson-diff >=1.1.0.5 && <1.2.0.0+ , base >=4.11.1.0 && <5+ , bytestring >=0.10.8.2 && <0.12.0.0+ , directory >=1.3.1.5 && <1.4.0.0 , hspec >=2.7.9 && <2.10.0- , monad-logger >=0.3.36 && <0.4.0+ , monad-logger >=0.3.30 && <0.4.0 , monad-logger-aeson- , time >=1.9.3 && <1.12.0.0+ , time >=1.8.0.2 && <1.12.0.0 default-language: Haskell2010
package.yaml view
@@ -1,5 +1,5 @@ name: monad-logger-aeson-version: '0.3.0.1'+version: '0.3.0.2' github: "jship/monad-logger-aeson" license: MIT license-file: LICENSE.md@@ -30,14 +30,14 @@ library: dependencies: - aeson >=1.5.2.0 && <2.1.3.0- - base >=4.13.0.0 && <5- - bytestring >=0.10.10.1 && <0.12.0.0+ - base >=4.11.1.0 && <5+ - bytestring >=0.10.8.2 && <0.12.0.0 - context >=0.2.0.0 && <0.3- - exceptions >=0.10.4 && <0.11.0- - fast-logger >=3.0.2 && <3.2.0- - monad-logger >=0.3.36 && <0.4.0- - text >=1.2.4.0 && <1.3.0.0 || >=2.0 && <2.1- - time >=1.9.3 && <1.12.0.0+ - exceptions >=0.10.0 && <0.11.0+ - fast-logger >=2.4.11 && <3.2.0+ - monad-logger >=0.3.30 && <0.4.0+ - text >=1.2.3.1 && <1.3.0.0 || >=2.0 && <2.1+ - time >=1.8.0.2 && <1.12.0.0 - unordered-containers >=0.2.10.0 && <0.3.0.0 source-dirs: library @@ -49,14 +49,14 @@ - hspec-discover dependencies: - aeson >=1.5.2.0 && <2.1.3.0- - aeson-diff >=1.1.0.9 && <1.2.0.0- - base >=4.13.0.0 && <5- - bytestring >=0.10.10.1 && <0.12.0.0- - directory >=1.3.6.0 && <1.4.0.0+ - aeson-diff >=1.1.0.5 && <1.2.0.0+ - base >=4.11.1.0 && <5+ - bytestring >=0.10.8.2 && <0.12.0.0+ - directory >=1.3.1.5 && <1.4.0.0 - hspec >=2.7.9 && <2.10.0- - monad-logger >=0.3.36 && <0.4.0+ - monad-logger >=0.3.30 && <0.4.0 - monad-logger-aeson- - time >=1.9.3 && <1.12.0.0+ - time >=1.8.0.2 && <1.12.0.0 executables: readme-example:@@ -64,7 +64,7 @@ main: readme-example.hs dependencies: - aeson >=1.5.2.0 && <2.1.3.0- - base >=4.13.0.0 && <5- - monad-logger >=0.3.36 && <0.4.0+ - base >=4.11.1.0 && <5+ - monad-logger >=0.3.30 && <0.4.0 - monad-logger-aeson- - text >=1.2.4.0 && <1.3.0.0 || >=2.0 && <2.1+ - text >=1.2.3.1 && <1.3.0.0 || >=2.0 && <2.1
test-suite/Test/Control/Monad/Logger/AesonSpec.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -56,117 +55,117 @@ spec :: Spec spec = do- aroundAll withTempLogFile do- describe "Control.Monad.Logger.Aeson" do- describe "logDebug" do- it "no metadata + no thread context" \logFilePath -> do+ aroundAll withTempLogFile $ do+ describe "Control.Monad.Logger.Aeson" $ do+ describe "logDebug" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogDebug.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogDebug.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogDebug.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogDebug.MetadataYesThreadContextYes.testCase logFilePath - describe "logInfo" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logInfo" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogInfo.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogInfo.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogInfo.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogInfo.MetadataYesThreadContextYes.testCase logFilePath - describe "logWarn" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logWarn" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogWarn.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogWarn.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogWarn.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogWarn.MetadataYesThreadContextYes.testCase logFilePath - describe "logError" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logError" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogError.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogError.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogError.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogError.MetadataYesThreadContextYes.testCase logFilePath - describe "logOther" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logOther" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogOther.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogOther.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogOther.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogOther.MetadataYesThreadContextYes.testCase logFilePath - describe "logDebugNS" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logDebugNS" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogDebugNS.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogDebugNS.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogDebugNS.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogDebugNS.MetadataYesThreadContextYes.testCase logFilePath - describe "logInfoNS" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logInfoNS" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogInfoNS.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogInfoNS.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogInfoNS.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogInfoNS.MetadataYesThreadContextYes.testCase logFilePath - describe "logWarnNS" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logWarnNS" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogWarnNS.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogWarnNS.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogWarnNS.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogWarnNS.MetadataYesThreadContextYes.testCase logFilePath - describe "logErrorNS" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logErrorNS" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogErrorNS.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogErrorNS.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogErrorNS.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogErrorNS.MetadataYesThreadContextYes.testCase logFilePath - describe "logOtherNS" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logOtherNS" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogOtherNS.MetadataNoThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogOtherNS.MetadataNoThreadContextYes.testCase logFilePath- it "metadata + no thread context" \logFilePath -> do+ it "metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.LogOtherNS.MetadataYesThreadContextNo.testCase logFilePath- it "metadata + thread context" \logFilePath -> do+ it "metadata + thread context" $ \logFilePath -> do runTest $ TestCase.LogOtherNS.MetadataYesThreadContextYes.testCase logFilePath - describe "Control.Monad.Logger.CallStack ('log*' from 'monad-logger')" do- describe "logDebug" do- it "no metadata + no thread context" \logFilePath -> do+ describe "Control.Monad.Logger.CallStack ('log*' from 'monad-logger')" $ do+ describe "logDebug" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.MonadLogger.LogDebug.ThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.MonadLogger.LogDebug.ThreadContextYes.testCase logFilePath - describe "logDebugN" do- it "no metadata + no thread context" \logFilePath -> do+ describe "logDebugN" $ do+ it "no metadata + no thread context" $ \logFilePath -> do runTest $ TestCase.MonadLogger.LogDebugN.ThreadContextNo.testCase logFilePath- it "no metadata + thread context" \logFilePath -> do+ it "no metadata + thread context" $ \logFilePath -> do runTest $ TestCase.MonadLogger.LogDebugN.ThreadContextYes.testCase logFilePath
test-suite/TestCase.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE TypeApplications #-} module TestCase@@ -63,9 +62,9 @@ Exception.bracket (IO.openTempFile "." "monad-logger-aeson") (\(filePath, handle) -> IO.hClose handle *> Directory.removeFile filePath)- \(filePath, handle) -> do+ (\(filePath, handle) -> do IO.hClose handle- f filePath+ f filePath) shouldMatchWithPatch :: (HasCallStack) => Value -> (Value, Patch) -> Expectation shouldMatchWithPatch actualValue (expectedValue, expectedPatch) = do
test-suite/TestCase/LogDebug/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logDebug "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogDebug.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogDebug/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -61,7 +60,7 @@ { loc_package = "main" , loc_module = "TestCase.LogDebug.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogDebug/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogDebug/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logDebug $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogDebug.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogDebug/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -68,7 +67,7 @@ { loc_package = "main" , loc_module = "TestCase.LogDebug.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogDebug/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogDebugNS/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logDebugNS "tests" "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogDebugNS.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogDebugNS/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -62,7 +61,7 @@ { loc_package = "main" , loc_module = "TestCase.LogDebugNS.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogDebugNS/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogDebugNS/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logDebugNS "tests" $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogDebugNS.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogDebugNS/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -69,7 +68,7 @@ { loc_package = "main" , loc_module = "TestCase.LogDebugNS.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogDebugNS/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogError/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logError "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogError.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogError/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -61,7 +60,7 @@ { loc_package = "main" , loc_module = "TestCase.LogError.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogError/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogError/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logError $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogError.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogError/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -68,7 +67,7 @@ { loc_package = "main" , loc_module = "TestCase.LogError.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogError/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogErrorNS/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logErrorNS "tests" "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogErrorNS.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogErrorNS/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -62,7 +61,7 @@ { loc_package = "main" , loc_module = "TestCase.LogErrorNS.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogErrorNS/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogErrorNS/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logErrorNS "tests" $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogErrorNS.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogErrorNS/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -69,7 +68,7 @@ { loc_package = "main" , loc_module = "TestCase.LogErrorNS.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogErrorNS/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogInfo/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logInfo "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogInfo.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogInfo/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -61,7 +60,7 @@ { loc_package = "main" , loc_module = "TestCase.LogInfo.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogInfo/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogInfo/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logInfo $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogInfo.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogInfo/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -68,7 +67,7 @@ { loc_package = "main" , loc_module = "TestCase.LogInfo.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogInfo/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogInfoNS/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logInfoNS "tests" "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogInfoNS.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogInfoNS/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -62,7 +61,7 @@ { loc_package = "main" , loc_module = "TestCase.LogInfoNS.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogInfoNS/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogInfoNS/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logInfoNS "tests" $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogInfoNS.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogInfoNS/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -69,7 +68,7 @@ { loc_package = "main" , loc_module = "TestCase.LogInfoNS.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogInfoNS/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogOther/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logOther (LevelOther "foo") "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogOther.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogOther/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -61,7 +60,7 @@ { loc_package = "main" , loc_module = "TestCase.LogOther.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogOther/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogOther/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logOther (LevelOther "foo") $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogOther.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogOther/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -68,7 +67,7 @@ { loc_package = "main" , loc_module = "TestCase.LogOther.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogOther/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogOtherNS/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logOtherNS "tests" (LevelOther "foo") "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogOtherNS.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogOtherNS/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -62,7 +61,7 @@ { loc_package = "main" , loc_module = "TestCase.LogOtherNS.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogOtherNS/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogOtherNS/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logOtherNS "tests" (LevelOther "foo") $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogOtherNS.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogOtherNS/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -69,7 +68,7 @@ { loc_package = "main" , loc_module = "TestCase.LogOtherNS.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogOtherNS/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogWarn/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logWarn $ "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogWarn.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogWarn/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -61,7 +60,7 @@ { loc_package = "main" , loc_module = "TestCase.LogWarn.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogWarn/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogWarn/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logWarn $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogWarn.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogWarn/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "context": {@@ -68,7 +67,7 @@ { loc_package = "main" , loc_module = "TestCase.LogWarn.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogWarn/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/LogWarnNS/MetadataNoThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logWarnNS "tests" "No metadata" , logFilePath , expectedValue =@@ -31,7 +30,7 @@ "package": "main", "module": "TestCase.LogWarnNS.MetadataNoThreadContextYes", "file": "test-suite/TestCase/LogWarnNS/MetadataNoThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -62,7 +61,7 @@ { loc_package = "main" , loc_module = "TestCase.LogWarnNS.MetadataNoThreadContextYes" , loc_filename = "test-suite/TestCase/LogWarnNS/MetadataNoThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/LogWarnNS/MetadataYesThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -19,7 +18,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do logWarnNS "tests" $ "With metadata" :# [ "a" .= (42 :: Int) , "b" .= ("x" :: String)@@ -34,7 +33,7 @@ "package": "main", "module": "TestCase.LogWarnNS.MetadataYesThreadContextYes", "file": "test-suite/TestCase/LogWarnNS/MetadataYesThreadContextYes.hs",- "line": 23,+ "line": 22, "char": 11 }, "source": "tests",@@ -69,7 +68,7 @@ { loc_package = "main" , loc_module = "TestCase.LogWarnNS.MetadataYesThreadContextYes" , loc_filename = "test-suite/TestCase/LogWarnNS/MetadataYesThreadContextYes.hs"- , loc_start = (23, 11)+ , loc_start = (22, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Just "tests"
test-suite/TestCase/MonadLogger/LogDebug/ThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -18,7 +17,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do ML.logDebug "Logged from 'monad-logger'" , logFilePath , expectedValue =@@ -30,7 +29,7 @@ "package": "main", "module": "TestCase.MonadLogger.LogDebug.ThreadContextYes", "file": "test-suite/TestCase/MonadLogger/LogDebug/ThreadContextYes.hs",- "line": 22,+ "line": 21, "char": 11 }, "context": {@@ -60,7 +59,7 @@ { loc_package = "main" , loc_module = "TestCase.MonadLogger.LogDebug.ThreadContextYes" , loc_filename = "test-suite/TestCase/MonadLogger/LogDebug/ThreadContextYes.hs"- , loc_start = (22, 11)+ , loc_start = (21, 11) , loc_end = (0, 0) } , loggedMessageLogSource = Nothing
test-suite/TestCase/MonadLogger/LogDebugN/ThreadContextYes.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}@@ -18,7 +17,7 @@ testCase logFilePath = TestCase { actionUnderTest = do- withThreadContext ["reqId" .= ("74ec1d0b" :: String)] do+ withThreadContext ["reqId" .= ("74ec1d0b" :: String)] $ do ML.logDebugN "Logged from 'monad-logger'" , logFilePath , expectedValue =