logf: formalize temporary props
Opened this issue · 0 comments
jnichols-git commented
My use of logf requires that I include HTTP request values (request ID, session ID) in log properties, but getting them out of context is verbose, so I'm passing the context as a property, then using the format to extract those values and delete the context prop. This works pretty well.
I don't want to encourage use of arbitrary objects as props to be output in format, but something like logf.Temp(name string, value any)
that creates a prop visible to the formatter but not to the log output could allow for handy optional-value passing. Could work by prepending tmp_
to the name, then having the corresponding GetTemp
do the same.