ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/CommonLibs/plog/Formatters/TxtFormatter.h
(Generate patch)

Comparing s10k/CommonLibs/plog/Formatters/TxtFormatter.h (file contents):
Revision 1073 by s10k, Thu Oct 5 17:48:32 2017 UTC vs.
Revision 1096 by s10k, Sat Dec 30 14:40:33 2017 UTC

# Line 1 | Line 1
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 < }
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 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)