static int adjustEnd(String msg, int start, int originEnd) {
        if (originEnd == msg.length()) {
            // Already end of message.
            return originEnd;
        }
        if (msg.charAt(originEnd) == '\n') {
            // Already prior to '\n'.
            return originEnd;
        }
        // Search back for '\n'.
        int last = originEnd - 1;
        while (start < last) {
            if (msg.charAt(last) == '\n') {
                return last + 1;
            }
            last--;
        }
        return originEnd;
    }
Move the end to the nearest line separator('\n') (if exist).
android/android_framework/base/src/main/java/com/elvishew/xlog/printer/AndroidPrinter.java