MCPcopy Create free account
hub / github.com/apache/brpc / RawLog

Function RawLog

src/butil/logging.cc:1572–1601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1570}
1571
1572void RawLog(int level, const char* message) {
1573 if (level >= FLAGS_minloglevel) {
1574 size_t bytes_written = 0;
1575 const size_t message_len = strlen(message);
1576 int rv;
1577 while (bytes_written < message_len) {
1578 rv = HANDLE_EINTR(
1579 write(STDERR_FILENO, message + bytes_written,
1580 message_len - bytes_written));
1581 if (rv < 0) {
1582 // Give up, nothing we can do now.
1583 break;
1584 }
1585 bytes_written += rv;
1586 }
1587
1588 if (message_len > 0 && message[message_len - 1] != '\n') {
1589 do {
1590 rv = HANDLE_EINTR(write(STDERR_FILENO, "\n", 1));
1591 if (rv < 0) {
1592 // Give up, nothing we can do now.
1593 break;
1594 }
1595 } while (rv != 1);
1596 }
1597 }
1598
1599 if (FLAGS_crash_on_fatal_log && level == BLOG_FATAL)
1600 butil::debug::BreakDebugger();
1601}
1602
1603// This was defined at the beginning of this file.
1604#undef write

Callers

nothing calls this directly

Calls 1

BreakDebuggerFunction · 0.85

Tested by

no test coverage detected