microsoft / microsoft/onnxruntime
Allow disabling colors in the output
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### Describe the issue
`onnxruntime/core/common/logging/sinks/ostream_sink.cc` defines message color activator sequences and then uses them unconditionally. When redirecting this output into a file, it becomes less readable. Would be great to have an option to disable the use of colors in the output.
### To reproduce
Here is an example of the output captured by the logging system:
```
2025/01/07 00:02:06 [stderr] [1;31m2025-01-07 00:02:06.180133144 [E:onnxruntime:Default, provider_bridge_ort.cc:1862 TryGetProviderInfo_CUDA] /onnxruntime_src/onnxruntime/core/session/provider_bridge_ort.cc:1539 onnxruntime::Provider& onnxruntime::ProviderLibrary::Get() [ONNXRuntimeError] : 1 : FAIL : Failed to load library libonnxruntime_providers_cuda.so with error: libcudnn.so.9: cannot open shared object file: No such file or directory
2025/01/07 00:02:06 [stderr] [m
```
### Urgency
_No response_
### Platform
Linux
### OS Version
Ubuntu 22.04.1
### ONNX Runtime Installation
Released Package
### ONNX Runtime Version or Commit ID
1.16.1
### ONNX Runtime API
Python
### Architecture
X64
### Execution Provider
CUDA
### Execution Provider Library Version
_No response_
Contributor guide
Research direction
Start with onnxruntime/core/common/logging/sinks/ostream_sink.cc, where the color escape sequences are defined and used unconditionally. Trace how logging options reach this sink and identify the appropriate configuration path for disabling colors. Done means redirected output can omit the color sequences while preserving the existing log messages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100