Open dmihalcik-virtru opened 1 month ago
Are you suggesting we use this syntax logger.LogAttrs(ctx, slog.LevelInfo, "hello", slog.Int("count", 3))
rather than slog.InfoContext(ctx, "hello", slog.Int("count", 3))
?
What kind of efficiency gains do we get? Seems that this could prove challenging to enforce.
It looks like the efficiency gains are minimal. zap maintains a performance comparison and it looks like we only save 2 allocs (out of about 4x the number of attributes we allocate in a line).
Alternatives:
LogAttrs
for efficiencyAudit
events. Prefer using Context and Attr structs.LogAttrs
How it looks:
Custom Logger
No Rules