Bug #6249
closed
logging: ANSI color sequences should be reset after log message
Added by manawyrm 9 months ago.
Updated 2 months ago.
Description
Currently, libosmocore will output color control escape sequences to print logs in a specific color.
When logging these messages to something mixed with other messages (like systemd-journald), the missing reset at the end of the message causes output like this:
Proposed fix: Output a color reset at the end of each log message. This adds 4 bytes (escape, [0m) at the end of each message, which IMHO is reasonable.
Files
I was actually under the assumption that this is what we did. Seems like it isn't?
Yes, I had a brief look at the code and there is indeed code to reset the colors after each block/message.
Not quite sure why/where the last reset is getting lost.
Could you maybe tell me about the expected behaviour? I'm guessing the text itself shouldn't be coloured at all?
On Tue, Nov 07, 2023 at 10:37:56AM +0000, manawyrm wrote:
Could you maybe tell me about the expected behaviour? I'm guessing the text itself shouldn't be coloured at all?
that all depends on your log configuration. It supports a large variety of modes. In the
default mode, indeed the whole line would be colored according to the sub-system log color. Each subsystem
uses a different color.
- Status changed from New to Resolved
- % Done changed from 0 to 100
- Related to Bug #6284: '\0' in log output added
- Status changed from Resolved to In Progress
- Status changed from In Progress to Resolved
Also available in: Atom
PDF