Possibly a bug or potential improvement in slog.
This will sound excessively complicated, which I recognize and have changed my approach. Regardless, I see an opportunity to improve surprising behavior.
I'm looking for feedback on whether I missed something in the slog documentation or if this is a valid bug or improvement, in which case I can file it.
slog.Value always json.marshals to an empty document, "{}", which to me was surprising behavior when using JsonHandler. If a slog.Value is embedded in a logged non-slog.Value, for example a slice, it will effectively omit data. On the other hand any tree of Values and Attrs passed directly to the log functions, without an intervening non-slog.Value object, marshals and logs properly. I expect a slice, or any other non-slog.Value type, containing an slog.Value to marshal to json with the slog.Value's represented value.
Alternatively, the slog documentation (or specifically JsonHandler) could state that no non-slog.Value object passed to a log method may contain an slog.Value, and that LogValuers must maintain this invariant.
I discovered this when logging (using JsonHandler) an object containing a list of objects whose logged data I wanted to redact/reduce. I do this as a LogValuer whose LogValue function constructs and returns a new slog.GroupValue with a []slog.Value containing the redacted objects for logging. Each Value is created by in turn calling Value.Resolve(Value.anyValue(...)) on the component items. The resulting log contains a list of empty documents. I think this is a reasonable use of LogValue, though I recognize that many people will suggest not logging slices.
Thanks,
Steve