Traditional structured logging is a quite expensive operation as it involves parsing the template string at runtime, and its memory is allocated for the arguments array even if the specified log level is disabled. Also, it is easy to forget some arguments or use a wrong argument order.
Looking at the above screenshot, we observe that by using traditional Structured Logging we get 94.43 ns and by using the custom string interpolation techniques we get almost 14ns.
Also, memory usage is nil when the log level is disabled by using the custom handler.
We should explore this or any other efficient log method further.
Traditional structured logging is a quite expensive operation as it involves parsing the template string at runtime, and its memory is allocated for the arguments array even if the specified log level is disabled. Also, it is easy to forget some arguments or use a wrong argument order.
Please look at the following links
Looking at the above screenshot, we observe that by using traditional Structured Logging we get 94.43 ns and by using the custom string interpolation techniques we get almost 14ns. Also, memory usage is nil when the log level is disabled by using the custom handler. We should explore this or any other efficient log method further.