spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

Error even when using const char*

Open WeleSS2 opened this issue 1 year ago • 3 comments

This is first library where i can't even use const char* as string...

    const char* tt = "test {}";

    spdlog::debug(tt, std::source_location::current().file_name());

Is throwing a nice error image

NOthing in docs of fmt work, any way to solve it or i just need to abandon fmt and spd?

WeleSS2 avatar Oct 13 '24 16:10 WeleSS2

Use fmt::runtime() to avoid compile-time-check: https://fmt.dev/11.0/api/#compile-time-checks

     const char* tt = "test {}";

-    spdlog::debug(tt, std::source_location::current().file_name());
+    spdlog::debug(fmt::runtime(tt), std::source_location::current().file_name());

tt4g avatar Oct 13 '24 20:10 tt4g

Finally working solution! Thanks a lot tt4g! You can close this issue, i was sitting over it nearly 2 weeks and wanted to abandon spd and fmt.

WeleSS2 avatar Oct 13 '24 23:10 WeleSS2

Please please close this issue. I can't close this issue because I'm not the maintainer of this repository.

tt4g avatar Oct 14 '24 00:10 tt4g