-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] spdlog v2.x status #3316
Comments
Well it passes all the tests, so it seems ok. But, it is wip and API will probably change. There is no release date yet. Which changes in particular are you interested in ? |
I like logs in JSON format with custom Here is example of log line:
Here is a little code snippet: class JsonLogger
{
public:
explicit JsonLogger(std::shared_ptr<spdlog::logger> &&logger) : mLogger(std::move(logger))
{
}
using Level = spdlog::level;
template <typename... Args> using format_string_t = fmt::format_string<Args...>;
template <typename... Args> void Info(const JsonProperties &props, format_string_t<Args...> fmt, Args &&...args)
{
Log(Level::info, props, fmt, std::forward<Args>(args)...);
}
private:
template <typename... Args>
void Log(Level lvl, const JsonProperties &props, format_string_t<Args...> fmt, Args &&...args)
{
if (!mLogger->should_log(lvl))
{
return;
}
Log(lvl, props, fmt::format(fmt, std::forward<Args>(args)...));
}
void Log(Level lvl, const JsonProperties &props, std::string &&msg);
{
mLogger->log(
lvl, props.ToString() + R"(,"message":)" + nlohmann::json(std::move(msg)).dump()
);
}
std::shared_ptr<spdlog::logger> mLogger;
}; I found it easier to use the v2.x, I remember for exmaple that the check |
Hello, I like the changes in v2.x branch and I would like to use it in my project. I'm just worried if it's stable and well tested as the v1.x branch, since there is no release yet.
I guess my question is whether it is recommended using the v2.x and if there is release planned soon.
Thanks.
The text was updated successfully, but these errors were encountered: