implement a flag (in this case, an enumeration) that allows control over the type; we make it an enum for possible expansions of time abstractions that might make it into the C++ standard in the future (see Howard Hinnant's date/timezone library) or might be usefully-available from the OS at some point in time

This commit is contained in:
ThePhD
2017-05-30 18:05:25 -04:00
parent 13fb2550c6
commit 5c5080d304
7 changed files with 49 additions and 17 deletions

View File

@@ -29,15 +29,16 @@ class pattern_formatter SPDLOG_FINAL : public formatter
{
public:
explicit pattern_formatter(const std::string& pattern);
explicit pattern_formatter(const std::string& pattern, pattern_time ptime = pattern_time::local);
pattern_formatter(const pattern_formatter&) = delete;
pattern_formatter& operator=(const pattern_formatter&) = delete;
void format(details::log_msg& msg) override;
private:
const std::string _pattern;
const pattern_time _time;
std::vector<std::unique_ptr<details::flag_formatter>> _formatters;
void handle_flag(char flag);
void compile_pattern(const std::string& pattern);
void compile_pattern(const std::string& pattern, pattern_time ptime);
};
}