Pretty-prints this string with non-visible characters escaped.
Pretty-prints this string with non-visible characters escaped.
The exact definition of "non-visible" is fuzzy and is subject to change. The original motivation for this method was to fix https://github.com/scalameta/munit/issues/258 related to escaping \r in test names.
The spirit of this method is to preserve "visible" characters like emojis and double quotes and escape "non-visible" characters like newlines and ANSI escape codes. A non-goal of this method is to make the output copy-pasteable back into source code unlike the printChar method, which escapes for example double-quote characters.
Attributes
def log(any: Any, printer: Printer)(implicit loc: Location): Unit