Last change
on this file since 1085 was 1073, checked in by s10k, 7 years ago |
added XML Tools latest version (2.0d) and s10k's common libs
|
File size:
1.4 KB
|
Line | |
---|
1 | #pragma once
|
---|
2 | #include <plog/Record.h>
|
---|
3 | #include <plog/Util.h>
|
---|
4 | #include <iomanip>
|
---|
5 |
|
---|
6 | namespace plog
|
---|
7 | {
|
---|
8 | class TxtFormatter
|
---|
9 | {
|
---|
10 | public:
|
---|
11 | static util::nstring header()
|
---|
12 | {
|
---|
13 | return util::nstring();
|
---|
14 | }
|
---|
15 |
|
---|
16 | static util::nstring format(const Record& record)
|
---|
17 | {
|
---|
18 | tm t;
|
---|
19 | util::localtime_s(&t, &record.getTime().time);
|
---|
20 |
|
---|
21 | util::nstringstream ss;
|
---|
22 | ss << t.tm_year + 1900 << "-" << std::setfill(PLOG_NSTR('0')) << std::setw(2) << t.tm_mon + 1 << PLOG_NSTR("-") << std::setfill(PLOG_NSTR('0')) << std::setw(2) << t.tm_mday << PLOG_NSTR(" ");
|
---|
23 | ss << std::setfill(PLOG_NSTR('0')) << std::setw(2) << t.tm_hour << PLOG_NSTR(":") << std::setfill(PLOG_NSTR('0')) << std::setw(2) << t.tm_min << PLOG_NSTR(":") << std::setfill(PLOG_NSTR('0')) << std::setw(2) << t.tm_sec << PLOG_NSTR(".") << std::setfill(PLOG_NSTR('0')) << std::setw(3) << record.getTime().millitm << PLOG_NSTR(" ");
|
---|
24 | ss << std::setfill(PLOG_NSTR(' ')) << std::setw(5) << std::left << severityToString(record.getSeverity()) << PLOG_NSTR(" ");
|
---|
25 | ss << PLOG_NSTR("[") << record.getTid() << PLOG_NSTR("] ");
|
---|
26 | ss << PLOG_NSTR("[") << record.getFunc() << PLOG_NSTR("@") << record.getLine() << PLOG_NSTR("] ");
|
---|
27 | ss << record.getMessage() << PLOG_NSTR("\n");
|
---|
28 |
|
---|
29 | return ss.str();
|
---|
30 | }
|
---|
31 | };
|
---|
32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.