summaryrefslogtreecommitdiff
path: root/Logs/UUIDBased.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Logs/UUIDBased.hs')
-rw-r--r--Logs/UUIDBased.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/Logs/UUIDBased.hs b/Logs/UUIDBased.hs
index 7184709fe..9609d7321 100644
--- a/Logs/UUIDBased.hs
+++ b/Logs/UUIDBased.hs
@@ -50,28 +50,27 @@ showLog :: (a -> String) -> Log a -> String
showLog shower = unlines . map showpair . M.toList
where
showpair (k, LogEntry (Date p) v) =
- unwords [show k, shower v, tskey ++ show p]
+ unwords [fromUUID k, shower v, tskey ++ show p]
showpair (k, LogEntry Unknown v) =
- unwords [show k, shower v]
+ unwords [fromUUID k, shower v]
parseLog :: (String -> Maybe a) -> String -> Log a
-parseLog parser = M.fromListWith best . catMaybes . map pair . lines
+parseLog parser = M.fromListWith best . catMaybes . map parse . lines
where
- pair line
+ parse line
| null ws = Nothing
- | otherwise = case parser $ unwords info of
- Nothing -> Nothing
- Just v -> Just (read u, LogEntry c v)
+ | otherwise = parser (unwords info) >>= makepair
where
+ makepair v = Just (toUUID u, LogEntry ts v)
ws = words line
u = head ws
end = last ws
- c
+ ts
| tskey `isPrefixOf` end =
pdate $ tail $ dropWhile (/= '=') end
| otherwise = Unknown
info
- | c == Unknown = drop 1 ws
+ | ts == Unknown = drop 1 ws
| otherwise = drop 1 $ init ws
pdate s = case parseTime defaultTimeLocale "%s%Qs" s of
Nothing -> Unknown