Open dnsmichi opened 5 years ago
@htriem Please evaluate the library fmt during the coming weeks, when you got time.
Once done, continue with the integration into Icinga 2:
printf
for the String class and show how it works in the DSL - feature branchLogging
Header only: https://github.com/fmtlib/fmt/issues/596#issuecomment-341617817
#define FMT_HEADER_ONLY
#include "fmt/format.h"
Looks like this is more complicated to implement inside the DSL. We need to find a way to map a list of array items from fmt to the Icinga DSL. Therefore TBD.
Is there a real need for this? Sure, would be nice to have but this has been lying around for some time with no progress, so maybe wontfix for the foreseeable future?
@htriem You're not working on this, right?
Not currently, no.
Describe the solution you'd like
User-friendly support for formatting strings based on specific format patterns. Independent from the value type,
printf
style, orPython
style - common to the users.A Printing class as entry point for:
Utility::Format()
Creating a custom solution is a no-go, we'll need to evaluate possible candidates out there. Header only includes are preferred.
Related Issues
Describe alternatives you've considered
https://github.com/fmtlib/fmt will be the base for C++ 20's
std::format
implementation. Therefore it is safe to assume we can be use it and later convert to the standard library if needed.http://www.zverovich.net/2019/07/23/std-format-cpp20.html
If we consider replacing our logging library, spdlog also uses fmt under the hood. https://github.com/gabime/spdlog
Benchmarks