I am using spdlog with a registry application. I am getting an exception when attempting to log a single wchar_t string containing a reprentation of a CLSID, say "{0C092C21-882C-11CF-A6BB-080C7B2D682}". I understand that in spdlog "{}" is a formatting parameter character pair and accept an exception should be thrown for the data above, but how do I log such data?
Asked
Active
Viewed 1,364 times
1 Answers
0
You pass it as a parameter:
spdlog::error(L"{}", L"{0C092C21-882C-11CF-A6BB-080C7B2D682}");
You should do this in general for all input strings that aren't constant string literals whose content you know doesn't include format specifiers. Same applies to printf
family of functions, except the format specifiers are different for them.

eerorika
- 232,697
- 12
- 197
- 326
-
Thank you for your answer. I was hoping for a non-variadic solution. I wrap the spdlog in a class hopefully to aid swapping logging systems and support logging with utility member functions. At the point of failure/report/.. in the code I use wstringstream to build a error/debug/info/... message with all the local context information and use a single wstring parameter call to the log wrapper class. – mgriggle Mar 29 '19 at 07:23