HomeLogPrinter.kt 580 Bytes
Newer Older
徐健 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
package com.yidianling.home.utils

import android.util.Log

/**
 * Created by haorui on 2019/2/16.
 * Des:
 */
class HomeLogPrinter {
    companion object {
        /**
         * 解决LogCat打印长数据不完整问题
         */
        fun printLongLog(tag: String, msg: String) {
            var msg = msg
            val maxStrLength = 2001 - tag.length
            while (msg.length > maxStrLength) {
                Log.i(tag, msg.substring(0, maxStrLength))
                msg = msg.substring(maxStrLength)
            }
            Log.i(tag, msg)
        }

    }
}