This is just a quick little pull request that implements the new-to-net-6 InterpolatedStringHandler pattern for verbose logging. This way, .Monitor.VerboseLog($"any string interpolation {whatever}"} won't have the string interpolation evaluated UNLESS verbose logging is enabled.
It's fully backwards compatible and will require no changes from mod authors. If a mod isn't recompiled for this change, it'll just use the string overload, and if the mod is recompiled, it'll automatically switch over to using the InterpolatedStringHandler version.
One possible downside: this technically changes the behavior when a log message also has mutation built into it. (ie .Monitor.VerboseLog($"why {i++}") will no longer see i increment.)
Hi Pathos!
This is just a quick little pull request that implements the new-to-net-6 InterpolatedStringHandler pattern for verbose logging. This way,
.Monitor.VerboseLog($"any string interpolation {whatever}"}
won't have the string interpolation evaluated UNLESS verbose logging is enabled.It's fully backwards compatible and will require no changes from mod authors. If a mod isn't recompiled for this change, it'll just use the string overload, and if the mod is recompiled, it'll automatically switch over to using the InterpolatedStringHandler version.
One possible downside: this technically changes the behavior when a log message also has mutation built into it. (ie
.Monitor.VerboseLog($"why {i++}")
will no longer seei
increment.)Example log: https://smapi.io/log/4cf6b096effc4d10ae629124b42da742?Levels=trace%7Edebug%7Einfo%7Ewarn%7Eerror%7Ealert%7Ecritical&Page=2&PerPage=1000