You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ja...@apache.org on 2022/08/30 07:23:29 UTC
[incubator-brpc] branch master updated: expose logging::PrintLog
This is an automated email from the ASF dual-hosted git repository.
jamesge pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 2a50c541 expose logging::PrintLog
2a50c541 is described below
commit 2a50c541114f660d6d1d99d1efa1586fc9639039
Author: gejun.0 <ge...@bytedance.com>
AuthorDate: Tue Aug 30 15:23:14 2022 +0800
expose logging::PrintLog
---
src/butil/logging.cc | 8 ++++----
src/butil/logging.h | 5 +++++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/butil/logging.cc b/src/butil/logging.cc
index 9db75cde..09b3ddaf 100644
--- a/src/butil/logging.cc
+++ b/src/butil/logging.cc
@@ -466,7 +466,7 @@ static void PrintLogSeverity(std::ostream& os, int severity) {
}
}
-static void PrintLogPrefix(
+void PrintLogPrefix(
std::ostream& os, int severity, const char* file, int line) {
PrintLogSeverity(os, severity);
#if defined(OS_LINUX)
@@ -565,9 +565,9 @@ static void PrintLogPrefixAsJSON(
os << "\"C\":\"" << file << ':' << line << "\"";
}
-static void PrintLog(std::ostream& os,
- int severity, const char* file, int line,
- const butil::StringPiece& content) {
+void PrintLog(std::ostream& os,
+ int severity, const char* file, int line,
+ const butil::StringPiece& content) {
if (!FLAGS_log_as_json) {
PrintLogPrefix(os, severity, file, line);
os.write(content.data(), content.size());
diff --git a/src/butil/logging.h b/src/butil/logging.h
index f92cd780..e2a41098 100644
--- a/src/butil/logging.h
+++ b/src/butil/logging.h
@@ -319,6 +319,11 @@ private:
// Returns previous sink.
BUTIL_EXPORT LogSink* SetLogSink(LogSink* sink);
+// Print |content| with other info into |os|.
+void PrintLog(std::ostream& os,
+ int severity, const char* file, int line,
+ const butil::StringPiece& content);
+
// The LogSink mainly for unit-testing. Logs will be appended to it.
class StringSink : public LogSink, public std::string {
public:
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org