Intercom now supports logging through the Rust log infrastructure. This is performed by exposing intercom::logging module and delegating to this module from the macro expansion code.
The call sites are a bit more complicated than usual logging to ensure that the logging does not result in performance penalty in case logging is not enabled. This was verified with micro benchmarking the implementation:
Situation
Time
Original
525 ns/iter
Logging enabled
~100 000 ns/iter
Unconditional format_args!
620ns/iter
Conditional format_args!
580ns/iter
There might still be some minor optimization wins here by turning the logging code into usual if .. { log } construct, but I don't want that noise in our quote!(..) calls - a macro exposed by intercom would be an acceptable solution to this, but don't feel like going there for now.
Intercom now supports logging through the Rust
log
infrastructure. This is performed by exposingintercom::logging
module and delegating to this module from the macro expansion code.The call sites are a bit more complicated than usual logging to ensure that the logging does not result in performance penalty in case logging is not enabled. This was verified with micro benchmarking the implementation:
format_args!
format_args!
There might still be some minor optimization wins here by turning the logging code into usual
if .. { log }
construct, but I don't want that noise in ourquote!(..)
calls - a macro exposed byintercom
would be an acceptable solution to this, but don't feel like going there for now.Fixes #134