Skip to content

Commit 707a0e0

Browse files
authored
update comments in log moudule (#632)
### What problem were solved in this pull request? Issue Number: close #551 Problem: - The original comment for `Log::operator<<` incorrectly stated that it "won't output header information" (like function, file, line, etc.). - However, the actual implementation calls `Log::out()`, which internally uses `LOG_HEAD` macro to print full header info (timestamp, PID/TID, context, function, file, line). This mismatch can mislead users into thinking `operator<<` only writes raw message content, potentially causing confusion or misuse. ### What is changed and how it works? Updated the Doxygen-style comment above `Log::operator<<` template function in `src/common/log/log.h`. New comment clearly states: - `operator<<` **does output standard header info** (time, pid/tid, ctx, func, file, line). - If user wants to customize or suppress headers, they should use `output()` / `out()` methods directly. ### Other information No code logic changed — only comments correction.
1 parent 6e8cfaf commit 707a0e0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/common/log/log.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ class Log
6565
static int init(const string &log_file);
6666

6767
/**
68-
* These functions won't output header information such as __FUNCTION__,
69-
* The user should control these information
70-
* If the header information should be outputed
71-
* please use LOG_PANIC, LOG_ERROR ...
68+
* Stream-style logging with default level.
69+
* It will emit the standard log header (time/pid/tid/context/function/file/line)
70+
* via LOG_HEAD before the message, consistent with LOG_* macros.
71+
* If you need to customize or suppress headers, use output/out with your own
72+
* prefix handling instead of this operator.
7273
*/
7374
template <class T>
7475
Log &operator<<(T message);

0 commit comments

Comments
 (0)