katip 0.8.8.2 → 0.8.8.3
raw patch · 5 files changed
+14/−13 lines, 5 files
Files
- changelog.md +4/−0
- katip.cabal +1/−1
- src/Katip/Core.hs +7/−10
- src/Katip/Monadic.hs +1/−1
- test/Katip/Tests.hs +1/−1
changelog.md view
@@ -1,3 +1,7 @@+0.8.8.3+=======+* Don't rely on package names in `getLoc` [#159](https://github.com/Soostone/katip/pull/159)+ 0.8.8.2 ======= * Performance improvements [#152](https://github.com/Soostone/katip/pull/152)
katip.cabal view
@@ -1,5 +1,5 @@ name: katip-version: 0.8.8.2+version: 0.8.8.3 synopsis: A structured logging framework. description: Katip is a structured logging framework. See README.md for more details.
src/Katip/Core.hs view
@@ -69,6 +69,7 @@ #endif import Data.List import qualified Data.Map.Strict as M+import Data.Maybe (listToMaybe) import Data.Semigroup as SG import qualified Data.Set as Set import Data.String@@ -98,7 +99,7 @@ #endif #if MIN_VERSION_base(4, 19, 0)-import GHC.Conc.Sync (fromThreadId)+import GHC.Conc.Sync (fromThreadId, labelThread) #else import Data.Maybe (fromMaybe) #endif@@ -785,7 +786,9 @@ ------------------------------------------------------------------------------- spawnScribeWorker :: Scribe -> BQ.TBQueue WorkerMessage -> IO (Async.Async ())-spawnScribeWorker (Scribe write _ _) queue = Async.async go+spawnScribeWorker (Scribe write _ _) queue = Async.async $ do+ myThreadId >>= flip labelThread "Scribe worker (katip)"+ go where go = do newCmd <- atomically (BQ.readTBQueue queue)@@ -1150,14 +1153,8 @@ -- callstacks when available (GHC > 7.8). #if MIN_VERSION_base(4, 8, 0) getLoc :: HasCallStack => Maybe Loc-getLoc = case getCallStack callStack of- [] -> Nothing- xs -> Just . toLoc . head $ filter filterKatip xs+getLoc = withFrozenCallStack $ toLoc <$> listToMaybe (getCallStack callStack) where- filterKatip :: (String, SrcLoc) -> Bool- filterKatip (_, srcloc) = not $- "katip-" `isPrefixOf` srcLocPackage srcloc- toLoc :: (String, SrcLoc) -> Loc toLoc (_, l) = Loc { loc_filename = srcLocFile l@@ -1208,7 +1205,7 @@ -> Severity -> LogStr -> m ()-logLoc a ns = logItem a ns getLoc+logLoc a ns = withFrozenCallStack $ logItem a ns getLoc -- taken from the file-location package
src/Katip/Monadic.hs view
@@ -319,7 +319,7 @@ Severity -> LogStr -> m ()-logLocM = logItemM getLoc+logLocM sev item = withFrozenCallStack $ logItemM getLoc sev item -------------------------------------------------------------------------------
test/Katip/Tests.hs view
@@ -136,7 +136,7 @@ ] --------------------------------------------------------------------------------loggingTests :: TestTree+loggingTests :: HasCallStack => TestTree loggingTests = testGroup "logging"