onnxruntime/onnxruntime
Edward Chen 5a5fec0452
Fix logs getting skipped in single-line conditionals. (#7589)
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!
2021-05-07 15:40:47 -07:00
..
contrib_ops Longformer Attention non-determinism issue fix (#7574) 2021-05-05 09:54:25 -07:00
core Fix logs getting skipped in single-line conditionals. (#7589) 2021-05-07 15:40:47 -07:00
featurizers_ops/cpu Consolidate MLTypeCallDispatcher classes (#6651) 2021-02-12 13:26:56 -08:00
gsl
python Add DLA support to TensorRT EP (#7532) 2021-05-07 10:31:42 -07:00
test Fix logs getting skipped in single-line conditionals. (#7589) 2021-05-07 15:40:47 -07:00
tool/etw
wasm [js/web] support multi-thread for wasm backend (#7601) 2021-05-07 12:12:37 -07:00
.style.yapf
__init__.py Add robust dependency check for Python package (#6436) 2021-02-21 15:11:28 -08:00
ReformatSource.ps1
ReformatSourcePython.bat
VSCodeCoverage.runsettings