You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to log additional information such as ctx.state.user.id. Is this currently possible?
In express-winston I could do this by passing a dynamicMeta option which takes a function and returns the extra meta data to be logged dynamically (at log time). That could work here too I think.
Another option here might be to treat the koa context much like req and res. So add options like ctxKeys, ctxSelect, and ctxUnselect to allow the user to choose which context properties are logged.
Would you accept a PR for one of these approaches?
The text was updated successfully, but these errors were encountered:
I also would like to see this happen. My preference would be for a dynamicMeta function option. It is more powerful than an array of keys, and the array of keys is too convenient for me. We should all be careful with what we log from a koa context, and writing a function to do it makes it more deliberate.
The dynamicMeta function should get the context as its argument and should be called at the very end of the chain, just before the log message is written, in case properties get added to the context by other middleware.
I'd like to log additional information such as
ctx.state.user.id
. Is this currently possible?In
express-winston
I could do this by passing adynamicMeta
option which takes a function and returns the extra meta data to be logged dynamically (at log time). That could work here too I think.Another option here might be to treat the koa
context
much likereq
andres
. So add options likectxKeys
,ctxSelect
, andctxUnselect
to allow the user to choose which context properties are logged.Would you accept a PR for one of these approaches?
The text was updated successfully, but these errors were encountered: