| 558 | } |
| 559 | |
| 560 | std::string LogInfoToLogStr(int severity, butil::StringPiece file, |
| 561 | int line, butil::StringPiece func, |
| 562 | butil::StringPiece content) { |
| 563 | // There's a copy here to concatenate prefix and content. Since |
| 564 | // DefaultLogSink is hardly used right now, the copy is irrelevant. |
| 565 | // A LogSink focused on performance should also be able to handle |
| 566 | // non-continuous inputs which is a must to maximize performance. |
| 567 | std::ostringstream os; |
| 568 | PrintLog(os, severity, file.data(), line, func.data(), content); |
| 569 | os << '\n'; |
| 570 | return os.str(); |
| 571 | } |
| 572 | |
| 573 | std::string LogInfo2LogStr(const LogInfo& log_info) { |
| 574 | return LogInfoToLogStr(log_info.severity, log_info.file, log_info.line, |
no test coverage detected