move QString-formatting to helpers.hpp so fS works with it all the time
This commit is contained in:
+2
-12
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fmt/format.h"
|
||||
#include "util/helpers.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTime>
|
||||
@@ -20,18 +20,8 @@ static void _log(const std::string &message)
|
||||
template <typename... Args>
|
||||
inline void Log(const std::string &formatString, Args &&... args)
|
||||
{
|
||||
detail::_log(fmt::format(formatString, std::forward<Args>(args)...));
|
||||
detail::_log(fS(formatString, std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
} // namespace debug
|
||||
} // namespace chatterino
|
||||
|
||||
namespace fmt {
|
||||
|
||||
// format_arg for QString
|
||||
inline void format_arg(BasicFormatter<char> &f, const char *&, const QString &v)
|
||||
{
|
||||
f.writer().write("\"{}\"", v.toStdString());
|
||||
}
|
||||
|
||||
} // namespace fmt
|
||||
|
||||
@@ -11,3 +11,13 @@ auto fS(Args &&... args) -> decltype(fmt::format(std::forward<Args>(args)...))
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
namespace fmt {
|
||||
|
||||
// format_arg for QString
|
||||
inline void format_arg(BasicFormatter<char> &f, const char *&, const QString &v)
|
||||
{
|
||||
f.writer().write("\"{}\"", v.toStdString());
|
||||
}
|
||||
|
||||
} // namespace fmt
|
||||
|
||||
Reference in New Issue
Block a user