Hi! Thanks for Napier. This PR provides a feature that no logging framework should be without: lazily evaluated log messages.
Each Napier.x(...) logging function is duplicated to additionally allow String-returning lambdas.
When using these signatures, the evaluation of messages is deferred until the required Log-level is confirmed (in Napier.log(...)).
This should be preferred for log messages whose String formatting incurs a significant cost: this can be avoided when in production.
Hi! Thanks for Napier. This PR provides a feature that no logging framework should be without: lazily evaluated log messages.
Each
Napier.x(...)
logging function is duplicated to additionally allow String-returning lambdas. When using these signatures, the evaluation of messages is deferred until the required Log-level is confirmed (inNapier.log(...)
).This should be preferred for log messages whose String formatting incurs a significant cost: this can be avoided when in production.