feat/update_config #10

Merged
tqcq merged 26 commits from feat/update_config into master 2024-10-14 10:15:01 +08:00
2 changed files with 3 additions and 1 deletions
Showing only changes of commit f5d3fcdf63 - Show all commits

View File

@ -389,7 +389,7 @@ LogSink::ToString(LogSeverity severity,
{ {
std::stringstream ss; std::stringstream ss;
char date_time[64]; char date_time[64];
sprintf(date_time, "%4d-%02d-%02dT%02d:%02d:%02d.%06d", logmsgtime.year() + 1900, logmsgtime.month(), sprintf(date_time, "%4d-%02d-%02dT%02d:%02d:%02d.%06d", logmsgtime.year() + 1900, logmsgtime.month() + 1,
logmsgtime.day(), logmsgtime.hour(), logmsgtime.min(), logmsgtime.sec(), logmsgtime.usec()); logmsgtime.day(), logmsgtime.hour(), logmsgtime.min(), logmsgtime.sec(), logmsgtime.usec());
ss << date_time; ss << date_time;

View File

@ -23,6 +23,8 @@ BasicFileSink::Send(LogSeverity severity,
size_t message_len) size_t message_len)
{ {
TILE_CHECK(!filepath_.empty(), "filepath is empty"); TILE_CHECK(!filepath_.empty(), "filepath is empty");
auto msg = ToString(severity, full_filename, base_filename, line, logmsgtime, message, message_len);
while (!msg.empty() && msg.back() != '\n') { msg.push_back('\n'); }
ofs_ << std::string(message, message_len) << std::endl; ofs_ << std::string(message, message_len) << std::endl;
} }