NanoLog icon indicating copy to clipboard operation
NanoLog copied to clipboard

Try std::string_view instead

Open KevinSmild opened this issue 5 years ago • 0 comments

Hello, Your logger implementation is really fast! Although we could not achieve the same performance as written in the documentation (maybe because of the difference in platform), it indeed outperform other loggers by far.

Now, I would like to make a small suggestion. I was trying to encapsulate the library inside of a class. Because of NanoLog's heavy dependency on constexpr, it was kind of cumbersome (just little tweaks here and there). To deal with the problem I changed the format string argument type from (&)[N] to std::string_view and it was easier to achieve my goal, without affecting performance.

My suggestion is just that: change (&)[N] to std::string_view. With that in mind, I don't know if there is a better way of doing this, but using string_views is definitely a solution.

Thanks, Kevin Baez.

KevinSmild avatar Jan 21 '21 01:01 KevinSmild