-- | Read one message
parseMessage :: String -> Maybe LogMessage
parseMessage line = do
    (name, val) <- parseValue line
    if any ($name) [(== "detail/req"), (== "detail/resp"), isPrefixOf "update/detail/trigger/"]
        then parseMaybe parseJSON val
        else Nothing

-- | Group requests
-- Every request is followed with several trigger messages and ends with response
-- Function returns list of such groups
parseMessage :: String -> Maybe LogMessage
parseMessage line = do
    (name, val) <- parseValue line
    if any ($name) [(== "detail/req"), (== "detail/resp"), isPrefixOf "update/detail/trigger/"]
        then parseMaybe parseJSON val
        else Nothing

-- | Group requests
-- Every request is followed with several trigger messages and ends with response
-- Function returns list of such groups
parseMessage line = do
    (name, val) <- parseValue line
    if any ($name) [(== "detail/req"), (== "detail/resp"), isPrefixOf "update/detail/trigger/"]
        then parseMaybe parseJSON val
        else Nothing

-- | Group requests
-- Every request is followed with several trigger messages and ends with response
-- Function returns list of such groups