@@ -128,30 +128,70 @@ class Katip m => KatipContext m where
128 getKatipContext :: m LogContexts
128 getKatipContext :: m LogContexts
129 getKatipNamespace :: m Namespace
129 getKatipNamespace :: m Namespace
131−--TODO: is this INLINABLE?
131+instance (KatipContext m, Katip (IdentityT m)) => KatipContext (IdentityT m) where
132−#define TRANS(T) \
132+ getKatipContext = lift getKatipContext
133+ getKatipNamespace = lift getKatipNamespace
136+instance (KatipContext m, Katip (MaybeT m)) => KatipContext (MaybeT m) where
137+ getKatipContext = lift getKatipContext
138+ getKatipNamespace = lift getKatipNamespace
141+instance (KatipContext m, Katip (EitherT e m)) => KatipContext (EitherT e m) where
142+ getKatipContext = lift getKatipContext
143+ getKatipNamespace = lift getKatipNamespace
146+instance (KatipContext m, Katip (ListT m)) => KatipContext (ListT m) where
147+ getKatipContext = lift getKatipContext
148+ getKatipNamespace = lift getKatipNamespace
151+instance (KatipContext m, Katip (ReaderT r m)) => KatipContext (ReaderT r m) where
152+ getKatipContext = lift getKatipContext
153+ getKatipNamespace = lift getKatipNamespace
156+instance (KatipContext m, Katip (ResourceT m)) => KatipContext (ResourceT m) where
157+ getKatipContext = lift getKatipContext
158+ getKatipNamespace = lift getKatipNamespace
161+instance (KatipContext m, Katip (Strict.StateT s m)) => KatipContext (Strict.StateT s m) where
162+ getKatipContext = lift getKatipContext
163+ getKatipNamespace = lift getKatipNamespace
166+instance (KatipContext m, Katip (StateT s m)) => KatipContext (StateT s m) where
167+ getKatipContext = lift getKatipContext
168+ getKatipNamespace = lift getKatipNamespace
171+instance (KatipContext m, Katip (ExceptT e m)) => KatipContext (ExceptT e m) where
172+ getKatipContext = lift getKatipContext
173+ getKatipNamespace = lift getKatipNamespace
133− instance (KatipContext m, Katip (T m)) => KatipContext (T m) where \
176+instance (Monoid w, KatipContext m, Katip (Strict.WriterT w m)) => KatipContext (Strict.WriterT w m) where
134− getKatipContext = lift getKatipContext; \
177+ getKatipContext = lift getKatipContext
135− getKatipNamespace = lift getKatipNamespace
178+ getKatipNamespace = lift getKatipNamespace
137−#define TRANS_CTX(CTX, T) \
180+
138− instance (CTX, KatipContext m, Katip (T m)) => KatipContext (T m) where \
181+instance (Monoid w, KatipContext m, Katip (WriterT w m)) => KatipContext (WriterT w m) where
139− getKatipContext = lift getKatipContext; \
182+ getKatipContext = lift getKatipContext
140− getKatipNamespace = lift getKatipNamespace
183+ getKatipNamespace = lift getKatipNamespace
143−TRANS(MaybeT)
186+instance (Monoid w, KatipContext m, Katip (Strict.RWST r w s m)) => KatipContext (Strict.RWST r w s m) where
144−TRANS(EitherT e)
187+ getKatipContext = lift getKatipContext
145−TRANS(ListT)
188+ getKatipNamespace = lift getKatipNamespace
148−TRANS(Strict.StateT s)
191+instance (Monoid w, KatipContext m, Katip (RWST r w s m)) => KatipContext (RWST r w s m) where
149−TRANS(StateT s)
192+ getKatipContext = lift getKatipContext
150−TRANS(ExceptT s)
193+ getKatipNamespace = lift getKatipNamespace
151−TRANS_CTX(Monoid w, Strict.WriterT w)
194+
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)
156deriving instance (Monad m, KatipContext m) => KatipContext (KatipT m)
196deriving instance (Monad m, KatipContext m) => KatipContext (KatipT m)
@@ -171,7 +211,6 @@ logItemM loc sev msg = do
171 logItem ctx ns loc sev msg
211 logItem ctx ns loc sev msg
175-------------------------------------------------------------------------------
214-------------------------------------------------------------------------------
176-- | Log with full context, but without any code
215-- | Log with full context, but without any code
177-- location. Automatically supplies payload and namespace.
216-- location. Automatically supplies payload and namespace.