private void appendMessage(
            boolean shouldParse,
            CharSequence msg,
            @Nullable Object[] args,
            ByteBuf buffer) {
        String message = msg.toString();
        if (!shouldParse) {
            buffer.writeBytes(StringUtil.getBytes(message));
            return;
        }
        int argCount = args == null
                ? 0
                : args.length;
        if (argCount == 0) {
            buffer.writeBytes(StringUtil.getBytes(message));
            return;
        }
        int argIndex = 0;
        byte[] bytes = StringUtil.getBytes(message);
        int length = bytes.length;
        for (int i = 0; i < length; i++) {
            byte b = bytes[i];
            if (b == '{' && i < length - 1 && bytes[i + 1] == '}') {
                if (argIndex < argCount) {
                    Object arg = args[argIndex++];
                    buffer.writeBytes(StringUtil.getUtf8Bytes(String.valueOf(arg)));
                } else {
                    buffer.writeBytes(NULL);
                }
                i++;
            } else {
                buffer.writeByte(b);
            }
        }
    }
@implNote Note that we do NOT escape or remove non-printable characters
turms-server-common/src/main/java/im/turms/server/common/infra/logging/core/layout/TurmsTemplateLayout.java