diff options
Diffstat (limited to 'src/core/lib/gpr/log_posix.cc')
-rw-r--r-- | src/core/lib/gpr/log_posix.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/lib/gpr/log_posix.cc b/src/core/lib/gpr/log_posix.cc index 6f93cdefcd..0acb225572 100644 --- a/src/core/lib/gpr/log_posix.cc +++ b/src/core/lib/gpr/log_posix.cc @@ -34,6 +34,10 @@ static intptr_t gettid(void) { return (intptr_t)pthread_self(); } void gpr_log(const char* file, int line, gpr_log_severity severity, const char* format, ...) { + /* Avoid message construction if gpr_log_message won't log */ + if (gpr_should_log(severity) == 0) { + return; + } char buf[64]; char* allocated = nullptr; char* message = nullptr; |