On Tuesday, 28 October 2014 at 08:38:50 UTC, Robert burner Schadek wrote:
Actually, that is only true for LogLevel given to a log call at runtime. calls to info, trace etc. are guarded with static if. So you're not paying any runtime overhead when calling log functions with LogLevel build in their name.
If I cannot change the version identifiers that a library was compiled with then the static if is always true. So you have to perform the check at runtime. The only way around that is to make each library function that performs logging a template, be it by passing a Logger with CT LogLevel or by turning functions into template functions so that the version identifiers leak into the library. The latter is more fragile because the compiler might omit instatiating a template or it might inline a function.
