Arduino-Log icon indicating copy to clipboard operation
Arduino-Log copied to clipboard

Fix CR LF definition

Open ldenisey opened this issue 2 years ago • 2 comments

Hello,

Thank you for maintaining the lib, it is very handy !

Sorry if I missed something but it seems that CR and LF definition were inverted.

ldenisey avatar Jan 15 '23 14:01 ldenisey

While this is technically correct, the historical examples gave CR as the line terminator. This change breaks that behavior and, in PIO for instance, leads to the same line being overwritten endlessly.

lbussy avatar Aug 24 '23 10:08 lbussy

Maybe change the examples to use "\n" instead of CR, but keep CR (defined to be LF!) for compatibility with a warning comment next to its definition? (It's also a little antisocial to be defining an unqualified two letter symbol like that, but that's another matter...)

But it's kind of weird that CR/LF doesn't get added automatically-- is the idea that you could emit multiple log events to construct a single longer line? That doesn't work with prefixes, though. Honestly I'd suggest to strip any trailing CR/LF characters from log text, add CR/LF after the suffix always, make the .xxxln() calls trivial passthrough to .xxx(), and drop all the newline-related stuff from the documentation. This is what almost every other logging library in the universe does.

egnor avatar Apr 16 '24 02:04 egnor