This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 471ac5f0 Support bthread id for log (#2570)
471ac5f0 is described below

commit 471ac5f0a4e66945f5c1137968ab15748b9b4be8
Author: Bright Chen <chenguangmin...@foxmail.com>
AuthorDate: Mon Mar 18 10:50:28 2024 +0800

    Support bthread id for log (#2570)
---
 src/butil/logging.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/butil/logging.cc b/src/butil/logging.cc
index 032a5448..6a43eafc 100644
--- a/src/butil/logging.cc
+++ b/src/butil/logging.cc
@@ -135,6 +135,8 @@ DEFINE_string(vmodule, "", "per-module verbose level."
 
 DEFINE_bool(log_pid, false, "Log process id");
 
+DEFINE_bool(log_bid, true, "Log bthread id");
+
 DEFINE_int32(minloglevel, 0, "Any log at or above this level will be "
              "displayed. Anything below this level will be silently ignored. "
              "0=INFO 1=NOTICE 2=WARNING 3=ERROR 4=FATAL");
@@ -809,6 +811,9 @@ void PrintLogPrefix(std::ostream& os, int severity,
     }
     os << ' ' << std::setfill(' ') << std::setw(5)
        << butil::PlatformThread::CurrentId() << std::setfill('0');
+    if (FLAGS_log_bid && bthread_self) {
+        os << ' ' << std::setfill(' ') << std::setw(5) << bthread_self();
+    }
     if (FLAGS_log_hostname) {
         butil::StringPiece hostname(butil::my_hostname());
         if (hostname.ends_with(".baidu.com")) { // make it shorter


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to