debug icon indicating copy to clipboard operation
debug copied to clipboard

Different formatting for namespaces on TTY and files

Open fgeorges opened this issue 2 years ago • 0 comments

It is possible to redirect the output of some namespaces to files (by assigning a function to debug.log), whilst maintaining others to stderr (by keeping debug.log undefined.)

But all lines are formatted the same way. If stderr is a TTY, they all get colours (using ANSI escape sequences), even in files, and no ISO datetime at the beginning. If stderr is not a TTY (e.g. using 2>&1 | cat) then colours are removed everywhere, even on stderr, and an ISO datetime is prepended to each line.

Is it possible to chose the formatting on a per-instance basis? That is, when I override debug.log, I would like to remove ANSI escape sequences, and add the ISO datetimes.

fgeorges avatar Oct 16 '23 16:10 fgeorges