private static String inBox(final String format,
                                final boolean addNewLine,
                                final Object... args) {
        if (format == null || format.isBlank()) {
            return "";
        } else {
            final String contentText = message(format, args);

            final int maxLineLen = contentText.lines()
                    .mapToInt(String::length)
                    .max()
                    .orElse(0);

            final String horizontalLine = Strings.repeat(String.valueOf(BOX_HORIZONTAL_LINE), maxLineLen + 4);
            final String horizontalSeparator = Strings.repeat(String.valueOf(BOX_HORIZONTAL_LINE), maxLineLen);
            final StringBuilder stringBuilder = new StringBuilder();
            if (addNewLine) {
                stringBuilder.append("\n");
            }
            // Top line
            stringBuilder
                    .append(BOX_TOP_LEFT)
                    .append(horizontalLine)
                    .append(BOX_TOP_RIGHT)
                    .append("\n");

            // Content
            contentText.lines()
                    .map(line -> {
                        // Add a pattern replacement to insert a horizontal rule like markdown.
                        if (line.equals("---")) {
                            return horizontalSeparator;
                        } else {
                            // Pad lines out to all the same length
                            final String variablePadding = Strings.repeat(" ", maxLineLen - line.length());
                            return line + variablePadding;
                        }
                    })
                    .forEach(linePlusPadding ->
                            stringBuilder
                                    .append(BOX_VERTICAL_LINE)
                                    .append("  ")
                                    .append(linePlusPadding)
                                    .append("  ")
                                    .append(BOX_VERTICAL_LINE)
                                    .append("\n"));

            // Bottom line
            stringBuilder
                    .append(BOX_BTM_LEFT)
                    .append(horizontalLine)
                    .append(BOX_BTM_RIGHT);

            return stringBuilder.toString();
        }
    }
Constructs a formatted message string using a format string that takes
the same placeholders as SLF4J, e.g.
"Function called with name {} and value {}"
This constructed message is placed inside a box.

@param format SLF4J style format string
@param args   The values for any placeholders in the message format
@return A formatted message in a box.
stroom-util/src/main/java/stroom/util/logging/LogUtil.java