How can I produce the output of a carriage return in a \message?

It's all in the title. How is it possible to output a carriage return in a \message. For debugging purposes, I need to get readable messages. The obvious doesn't work : \message{A\cr B} outputs A\cr B and \message{A\\B} produces an error like this

Undefined control sequence.
\\  ->\let \reserved@e
\relax \let \reserved@f


-

You don't say, but \reserved@a suggests that you are using latex in which case

\message{ab^^Jcde}


works although it is better to use latex constructs such as \typeout or \PackageInfo

In plain TeX the above \message will work if you set

\newlinechar=\^^J

-
Thanks for the answer and the hint to use \typeout, that actually solves the whole problem. – Tom-Tom Jan 20 at 9:23

The \message primitive expands input in the same way as \edef and needs something which produces a 'raw' new line to get the desired effect. On the other hand, \\ is a command to produce a line break in typesetting, so fails here (it is also not expandable, hence the odd error). You therefore need to insert a character equal to \newlinechar. In the LaTeX format this is ^^J:

\message{a^^JB}
\stop


In formats where this is not set (such as plain), you'll also need to cover that

\begingroup
\newlinechar=^^J %
\message{a^^JB}
\endgroup
\end

-
Thanks for the pedagogical answer ! – Tom-Tom Jan 20 at 9:21