RT-Thread / RT-Thread/rt-thread
[Bug] 使用带颜色的日志输出后不能恢复默认颜色问题
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 12.2k
- Forks
- 5.4k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 40
Description
RT-Thread Version
master
Hardware Type/Architectures
ulog
Develop Toolchain
GCC
Describe the bug
1.问题现象:ulog_tail_formater中的颜色结尾顺序是:先换行,再颜色结束码“[日志内容][换行][CSI_END]”。
这会导致:输出到终端后, CSI_END 在新行开头,而下一行是 shell 提示符,所以提示符并没有恢复默认颜色。
正确顺序应该是:[日志内容][CSI_END][换行]。
2.解决办法:原ulog.c文件404行至408行移至417行。
Other additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ulog.c, focusing on ulog_tail_formater and the referenced lines 404-408 and 417. Inspect the terminal color escape ordering, adjust the sequence as described in the issue, and verify that subsequent shell prompts use the default color after colored log output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100