loguru icon indicating copy to clipboard operation
loguru copied to clipboard

Add `loguru::printf_tag` to force printf syntax. Closes #49

Open topisani opened this issue 7 years ago • 3 comments

This seemed like the best way to handle the issue. All internal log calls pass the printf_tag tag, and thereby use the correct formatting.

topisani avatar Jan 06 '18 14:01 topisani

Ah, i see this creates issues with the c-style varargs. could we get rid of those by now? otherwise ill just keep this around on my fork

topisani avatar Jan 08 '18 13:01 topisani

Sorry for the slow response to this.

This is a rather clever solution, however I am considering maybe doing something more breaking instead. I already have a separate suffix for stream logging (LOG_S etc), so maybe a separate suffix for fmtlib, e.g. LOG_FMT. So it would be:

LOG_F(INFO, "Hello %s", "world");
LOG_S(INFO) << "Hello " << "world";
LOG_FMT(INFO, "Hello {}", "world");

and all three could work in the same code base.

Thoughts?

emilk avatar Feb 03 '18 13:02 emilk

Probably the best way to do it - I already define aliases to all logging macros in my code, so the extra two chars dont bother me, dont know about other people though

topisani avatar Feb 03 '18 15:02 topisani