@@ -61,12 +61,13 @@ run_logging _ n n0 n1= do
6161 logWarning msg
6262 logError msg
6363 endTime <- getPOSIXTime
64- threadDelay $ fromIntegral (5000 * n0)
64+ threadDelay $ fromIntegral (8000 * n0)
6565 let diffTime = nominalDiffTimeToMicroseconds (endTime - startTime)
6666 putStrLn $ " time for " ++ (show (n0* n1)) ++ " iterations: " ++ (show diffTime)
6767 lineslogged1 <- getLinesLogged
6868 let lineslogged = lineslogged1 - lineslogged0
6969 putStrLn $ " lines logged :" ++ (show lineslogged)
70+ threadDelay 0500000 -- wait for empty queue
7071 return (diffTime, lineslogged)
7172 where msg :: Text
7273 msg = replicate n " abcdefghijklmnopqrstuvwxyz"
@@ -102,6 +103,19 @@ spec = describe "Logging" $ do
102103 lc = lc0 & lcLoggerTree .~ newlt
103104 setupLogging " test" lc
104105
106+ modifyMaxSuccess (const 2 ) $ modifyMaxSize (const 2 ) $
107+ it " change minimum severity filter for a specific context" $
108+ monadicIO $ do
109+ lineslogged0 <- lift $ getLinesLogged
110+ lift $ usingLoggerName " silent" $ do { logWarning " you won't see this!" }
111+ lift $ threadDelay 0300000
112+ lift $ usingLoggerName " verbose" $ do { logWarning " now you read this!" }
113+ lift $ threadDelay 0300000
114+ lineslogged1 <- lift $ getLinesLogged
115+ let lineslogged = lineslogged1 - lineslogged0
116+ putStrLn $ " lines logged: " ++ (show lineslogged)
117+ assert (lineslogged == 1 )
118+
105119 modifyMaxSuccess (const 1 ) $ modifyMaxSize (const 1 ) $
106120 it " demonstrate logging" $
107121 monadicIO $ lift $ someLogging
@@ -118,16 +132,3 @@ spec = describe "Logging" $ do
118132 it " lines counted as logged must be equal to how many was intended to be written" $
119133 property prop_lines
120134
121- modifyMaxSuccess (const 2 ) $ modifyMaxSize (const 2 ) $
122- it " change minimum severity filter for a specific context" $
123- monadicIO $ do
124- lineslogged0 <- lift $ getLinesLogged
125- lift $ usingLoggerName " silent" $ do { logWarning " you won't see this!" }
126- lift $ threadDelay 0300000
127- lift $ usingLoggerName " verbose" $ do { logWarning " now you read this!" }
128- lift $ threadDelay 0300000
129- lineslogged1 <- lift $ getLinesLogged
130- let lineslogged = lineslogged1 - lineslogged0
131- putStrLn $ " lines logged: " ++ (show lineslogged)
132- assert (lineslogged == 1 )
133-
0 commit comments