Closed adamchester closed 9 years ago
No insights to add, but just for the sake of a second opinion I'd favour the safer and simpler option. Seems like an optimisation could be added down the track in a potentially non-breaking way if needed. So far hasn't been requested of Serilog. YMMV ;-)
I think I'm happy with doing things the way Serilog does, and I think I'm not too far away from doing the same in the F# version over in #14, so I'm closing this :)
The F# implementation currently doesn't do anything much in this area (the tests are explicitly ignored right now). The C# implementation is based on serilog and does whatever Serilog did.
This comment from @nblumhardt is interesting:
For my purposes, this seems quite important. If some library (eg. suave) needs to log the property values associated with a structured message template, it needs to be able capture them into a reasonable structured format.
What's interesting in F# land is that many core types (such as records and lists) are immutable by default, but records (for example) can be made mutable by either having mutable fields or using the
CLIMutable
attribute. I think this means the F# context is no different to serilog. Anything that needs to be logged/captured byMessageTemplates
is potentially mutable, and many bad things would happen if the values are changed by another thread.I wonder if there should be a way to avoid the copy of the objects if the template owner knows they're immutable? I wonder how ugly it would get when they make a mistake?