| 348 | } |
| 349 | |
| 350 | int sync() override { |
| 351 | flushPending(); |
| 352 | if (!pending_content_.empty()) { |
| 353 | // Also write data after the last new line. |
| 354 | log_writer_->write(pending_content_); |
| 355 | pending_content_.clear(); |
| 356 | } |
| 357 | return 0; |
| 358 | } |
| 359 | |
| 360 | // Flush pending_content_ + buffer_ up to the last new line to the log writer, and always move whatever is left in buffer_ to |
| 361 | // pending_content_. |