mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
Fix an issue where a log message got skipped.
A log call like this:
```
LOGS(...) << "message";
```
expands to something like this:
```
if (<output enabled>)
logging::Capture(...).Stream() << "message";
```
This if statement without brackets is handy for logging arbitrary arguments with the `<<` operator. However, it has other drawbacks like possibly associating with a subsequent `else`.
```
if (cond)
LOGS(...) << "a";
else
<do something> // not run when !cond
// equivalently:
if (cond)
if (<output enabled>)
logging::Capture(...).Stream() << "a";
else
<do something> // not run when !cond
```
Updated the logging macros to handle this case by replacing `if (<enabled>) logging::Capture(...).Stream()` with `if (!<enabled>) {} else logging::Capture(...).Stream()`.
Thanks @tlh20 for the idea for the fix!
|
||
|---|---|---|
| .. | ||
| onnxruntime/core | ||