Commit Graph

6 Commits

Author SHA1 Message Date
Sean d92a906fca
Allow user configuration of which logger to return from Ctx() (#343)
If a user is trying to fetch a logger from their context, they probably
want to log something.  In order to allow returning a useable logger from Ctx()
without breaking backwards compatibilty with the previous behavior, we make it
configurable.
2021-08-12 02:18:16 +02:00
Olivier Poitrey 9cd6f6eef2
ctx: store logger in context when missing or different that stored one (#81)
Current implementation stores a copy of the logger as a pointer and
update its content, which is now unecessary since the introduction of
WithContext.

The new WithContext now takes the pointer and store it in the context if
none is stored already or if the last one stored is a different pointer.
This way it is still possible to update the context of a logger stored
in the context, but it is also possible to store a copy of the logger in
a sub-context.

Fix #80
2018-07-02 18:23:53 -07:00
Olivier Poitrey e26050b2a3 Improve hlog handlers performance by switching to pointer logger
Update request logger's context thru its pointer in order to avoid
multiple copies/allocations.
2017-08-29 22:53:32 -07:00
Olivier Poitrey 6a6144a10b Add http.Handler helpers (adapted from xlog) 2017-05-20 01:48:00 -07:00
Olivier Poitrey 3f54be8716 Improve context.Context logging 2017-05-20 00:22:37 -07:00
Olivier Poitrey 19dfb55aa8 Add context methods 2017-05-19 12:59:10 -07:00