@@ -128,30 +128,70 @@ class Katip m => KatipContext m where
128128 getKatipContext :: m LogContexts
129129 getKatipNamespace :: m Namespace
130130
131−--TODO: is this INLINABLE?
132−#define TRANS(T) \
133− instance (KatipContext m, Katip (T m)) => KatipContext (T m) where \
134− getKatipContext = lift getKatipContext; \
135− getKatipNamespace = lift getKatipNamespace
136−
137−#define TRANS_CTX(CTX, T) \
138− instance (CTX, KatipContext m, Katip (T m)) => KatipContext (T m) where \
139− getKatipContext = lift getKatipContext; \
140− getKatipNamespace = lift getKatipNamespace
141−
142−TRANS(IdentityT)
143−TRANS(MaybeT)
144−TRANS(EitherT e)
145−TRANS(ListT)
146−TRANS(ReaderT r)
147−TRANS(ResourceT)
148−TRANS(Strict.StateT s)
149−TRANS(StateT s)
150−TRANS(ExceptT s)
151−TRANS_CTX(Monoid w, Strict.WriterT w)
152−TRANS_CTX(Monoid w, WriterT w)
153−TRANS_CTX(Monoid w, Strict.RWST r w s)
154−TRANS_CTX(Monoid w, RWST r w s)
131+instance (KatipContext m, Katip (IdentityT m)) => KatipContext (IdentityT m) where
132+ getKatipContext = lift getKatipContext
133+ getKatipNamespace = lift getKatipNamespace
134+
135+
136+instance (KatipContext m, Katip (MaybeT m)) => KatipContext (MaybeT m) where
137+ getKatipContext = lift getKatipContext
138+ getKatipNamespace = lift getKatipNamespace
139+
140+
141+instance (KatipContext m, Katip (EitherT e m)) => KatipContext (EitherT e m) where
142+ getKatipContext = lift getKatipContext
143+ getKatipNamespace = lift getKatipNamespace
144+
145+
146+instance (KatipContext m, Katip (ListT m)) => KatipContext (ListT m) where
147+ getKatipContext = lift getKatipContext
148+ getKatipNamespace = lift getKatipNamespace
149+
150+
151+instance (KatipContext m, Katip (ReaderT r m)) => KatipContext (ReaderT r m) where
152+ getKatipContext = lift getKatipContext
153+ getKatipNamespace = lift getKatipNamespace
154+
155+
156+instance (KatipContext m, Katip (ResourceT m)) => KatipContext (ResourceT m) where
157+ getKatipContext = lift getKatipContext
158+ getKatipNamespace = lift getKatipNamespace
159+
160+
161+instance (KatipContext m, Katip (Strict.StateT s m)) => KatipContext (Strict.StateT s m) where
162+ getKatipContext = lift getKatipContext
163+ getKatipNamespace = lift getKatipNamespace
164+
165+
166+instance (KatipContext m, Katip (StateT s m)) => KatipContext (StateT s m) where
167+ getKatipContext = lift getKatipContext
168+ getKatipNamespace = lift getKatipNamespace
169+
170+
171+instance (KatipContext m, Katip (ExceptT e m)) => KatipContext (ExceptT e m) where
172+ getKatipContext = lift getKatipContext
173+ getKatipNamespace = lift getKatipNamespace
174+
175+
176+instance (Monoid w, KatipContext m, Katip (Strict.WriterT w m)) => KatipContext (Strict.WriterT w m) where
177+ getKatipContext = lift getKatipContext
178+ getKatipNamespace = lift getKatipNamespace
179+
180+
181+instance (Monoid w, KatipContext m, Katip (WriterT w m)) => KatipContext (WriterT w m) where
182+ getKatipContext = lift getKatipContext
183+ getKatipNamespace = lift getKatipNamespace
184+
185+
186+instance (Monoid w, KatipContext m, Katip (Strict.RWST r w s m)) => KatipContext (Strict.RWST r w s m) where
187+ getKatipContext = lift getKatipContext
188+ getKatipNamespace = lift getKatipNamespace
189+
190+
191+instance (Monoid w, KatipContext m, Katip (RWST r w s m)) => KatipContext (RWST r w s m) where
192+ getKatipContext = lift getKatipContext
193+ getKatipNamespace = lift getKatipNamespace
194+
155195
156196deriving instance (Monad m, KatipContext m) => KatipContext (KatipT m)
157197
@@ -171,7 +211,6 @@ logItemM loc sev msg = do
171211 logItem ctx ns loc sev msg
172212
173213
174−
175214-------------------------------------------------------------------------------
176215-- | Log with full context, but without any code
177216-- location. Automatically supplies payload and namespace.