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

Method Log

src/butil/logging.cc:578–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576}
577
578void AsyncLogger::Log(const LogInfo& log_info) {
579 if (log_info.content.empty()) {
580 return;
581 }
582
583 bool is_full = FLAGS_max_async_log_queue_size > 0 &&
584 _log_request_count.fetch_add(1, butil::memory_order_relaxed) >
585 FLAGS_max_async_log_queue_size;
586 if (is_full || _stop.load(butil::memory_order_relaxed)) {
587 // Async logger is full or stopped, fallback to sync log.
588 DoLog(log_info);
589 return;
590 }
591
592 auto log_req = butil::get_object<LogRequest>();
593 if (!log_req) {
594 // Async log failed, fallback to sync log.
595 DoLog(log_info);
596 return;
597 }
598 log_req->log_info = log_info;
599 LogImpl(log_req);
600}
601
602void AsyncLogger::Log(LogInfo&& log_info) {
603 if (log_info.content.empty()) {

Callers 1

OnLogMessageMethod · 0.80

Calls 4

fetch_addMethod · 0.80
moveFunction · 0.70
emptyMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected