|
|
@@ -33,14 +33,24 @@ namespace logging {
|
|
|
|
|
|
using string_generator = std::function<std::string(logpacket const &)>;
|
|
|
string_generator get_date_formatter(std::string fmt);
|
|
|
+
|
|
|
+ class message {
|
|
|
+ public:
|
|
|
+ message() = default;
|
|
|
+ message(char const * fmt) : format_code(fmt) {}
|
|
|
+ template <typename... Args>
|
|
|
+ message(std::string const & fmt, Args && ...args);
|
|
|
+
|
|
|
+ std::string str() const;
|
|
|
|
|
|
- void format_msg(std::ostream & os, std::string const & interp, size_t pos,
|
|
|
- std::vector<detail::object> const & objs, size_t idx);
|
|
|
+ private:
|
|
|
+ std::string format_code;
|
|
|
+ std::vector<detail::object> objects;
|
|
|
+ };
|
|
|
|
|
|
template <typename... Args>
|
|
|
- std::string format_msg(std::string const & interp, Args && ...args) {
|
|
|
- std::stringstream msg;
|
|
|
- format_msg(msg, interp, 0, {detail::object(args)...}, 0);
|
|
|
- return msg.str();
|
|
|
+ message::message(std::string const & fmt, Args && ...args)
|
|
|
+ : format_code(fmt), objects({detail::object(args)...}) {
|
|
|
+
|
|
|
}
|
|
|
}
|