xotel: Handler doesn't properly handle alternating WithGroup/WithAttr calls
Opened this issue · 4 comments
Consider:
logger = logger.WithGroup("g").With("a", 1).WithGroup("h").With("b", 2)
The resulting attributes should be
g.a=1 g.h.b=2
I think the handler in this package will qualify both attributes with g.h
.
I think the handlers in xsentry
and xtesting
have the same problem.
See https://github.com/jba/slog/tree/main/withsupport for one way to deal with this.
@jba Hi Johnathan
Is the GroupOrAttrs stable or should we consider it as being subject to change prior to slog going out ?
Nothing in github.com/jba/slog is stable. I haven't tagged anything v1 yet, and may not do so for a while, if ever. Still, you can pin to a specific version (or if you prefer I could apply a v0 tag) and use that.
That said, the log/slog package is pretty much done at this point, so GroupOrAttrs is unlikely to change due to changes in slog.
Hopefully now the issue should be resolved.