public static String reformatParam(@Nullable Object param) {
    if (param == null) {
      return PARAM_NULL;
    }
    String abbreviated = abbreviate(param.toString(), PARAM_MAX_WIDTH);
    return NEWLINE_PATTERN.matcher(abbreviated).replaceAll("\\\\n");
  }
@Test
  public void reformatParam_escapes_newlines() {
    assertThat(SqlLogFormatter.reformatParam("foo\n  bar\nbaz")).isEqualTo("foo\\n  bar\\nbaz");
  }