mirror of
https://github.com/apple/swift-log
synced 2026-11-24 03:47:49 +00:00
Motivation:
Two reasons for the removal:
1. I don't see a compelling reason to add lazy metadata to the metadata
storage. Lazy metadata makes sense if it's passed directly to a log
method like
logger.info("foo", metadata: somethingExpensive())
but I don't think this makes a whole lot of sense
logger[metadataKey: "foo"] = .lazy({ somethingExpensive() })
why? It's very likely that it'll get evalutated because any next
log message that gets logged will force it but it's totally
unclear which one that'll be.
2. More importantly, the lazy metadata can't be implemented correctly
because we can't memoize the result of the expensive computation
because we can only mutate the `LogHandler` in mutating methods and
the log methods aren't mutating.