git.iko.soy/typeable/control-logger
on master help sign in
drop msg-keyword from log (#6761)
ca9ebacDmitry Olshansky
src/Control/Logger/Katip.hs+4−7
@@ -94,10 +94,9 @@ registerElastic gitRev verbosity ElasticServer{..} permitF env =
94 (Just u, Just p) -> applyBasicAuth u p
94 (Just u, Just p) -> applyBasicAuth u p
95 _ -> id
95 _ -> id
96
96
97−-- | Doubles the value of @msg@ key into the @msg-keyword@ and adds
98−-- the @rev-hash@ value to each record. The @msg-keyword@ is needed to
97+-- | Adds the @rev-hash@ value to each record.
99−-- group errors by message. The @rev-hash@ is needed for many purposes
98+-- Early we copied `msg` to `msg-keyword` here but drop it
100−-- and for grouping as well.
99+-- because purpose of this duplication is not clear.
101ourFormatter
100ourFormatter
102 :: Text
101 :: Text
103 -- ^ git revision string
102 -- ^ git revision string
@@ -107,13 +106,11 @@ ourFormatter gitRev verb = ItemFunc $ \item -> go $ ourItemJson verb item
107 where
106 where
108 go :: Value -> Value
107 go :: Value -> Value
109 go = \case
108 go = \case
110− Object h -> Object $ setRev $ dupMsg h
109+ Object h -> Object $ setRev h
111 x -> x -- drop exception here?
110 x -> x -- drop exception here?
112 where
111 where
113 setRev :: HM.HashMap Text Value -> HM.HashMap Text Value
112 setRev :: HM.HashMap Text Value -> HM.HashMap Text Value
114 setRev = HM.insert "rev-hash" (toJSON gitRev)
113 setRev = HM.insert "rev-hash" (toJSON gitRev)
115− dupMsg :: HM.HashMap Text Value -> HM.HashMap Text Value
116− dupMsg m = HM.alter (const $ HM.lookup "msg" m) "msg-keyword" m
117
114
118ourMapping :: K.MappingName ESV5 -> Value
115ourMapping :: K.MappingName ESV5 -> Value
119ourMapping mn = object
116ourMapping mn = object