Skip to content

Commit cc08f5f

Browse files
danakjchromeos-ci-prod
authored andcommitted
Disable debug and trace logs at compile time when not DCHECK_IS_ON()
This will avoid debug and trace logs from shipping as part of an official binary. Bug: 339678662 Change-Id: Ibadcfadcfa0cf412831a8b6831bf7ada93269b45 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5972895 Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1375289} CrOS-Libchrome-Original-Commit: c4ce7ab0119ef0445d777075120bcdfbace7e5d6
1 parent 93feb3c commit cc08f5f

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

base/logging/rust_log_integration.cc

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,16 @@ BASE_EXPORT void print_rust_log(const char* msg,
1919
const char* file,
2020
int line,
2121
enum RustLogSeverity severity) {
22-
// Drop debug and trace logs when DCHECK_IS_ON() is false. Otherwise, log them
23-
// as info, since the C++ implementation lacks support for debug and trace
24-
// logs.
25-
#if !DCHECK_IS_ON()
26-
if (severity == RustLogSeverity::DEBUG ||
27-
severity == RustLogSeverity::TRACE) {
28-
return;
29-
}
30-
#endif
31-
3222
logging::LogSeverity log_severity;
3323
switch (severity) {
3424
case RustLogSeverity::DEBUG:
25+
// Note that DEBUG level logs are dropped at compile time when
26+
// DCHECK_IS_ON() is false. This is done through a Cargo feature.
3527
log_severity = logging::LOGGING_INFO;
3628
break;
3729
case RustLogSeverity::TRACE:
30+
// Note that TRACE level logs are dropped at compile time when
31+
// DCHECK_IS_ON() is false. This is done through a Cargo feature.
3832
log_severity = logging::LOGGING_INFO;
3933
break;
4034
case RustLogSeverity::INFO:

0 commit comments

Comments
 (0)