主要功能就是打开logcat并保存到指定路径的文件中,当文件达到一定大小时,新建一个文件。
#[Working flow]
#Check nvtlog is existed in emmc or sd card
#If nvtlog is existed in USB disk
if [ -f /storage/usbdisk/nvtlogc ]; then
#dump tombstone if existed
[ -d /data/tombstones ] && cp -R /data/tombstones /storage/usbdisk
#start logging to usbdisk
echo "logging to external storage - USB disk"
[ -d /storage/usbdisk/nvtlog ] || mkdir /storage/usbdisk/nvtlog
logcat -v time -f /storage/usbdisk/nvtlog/log -r 1024 -n 50
fi
#If nvtlog is existed in SD card
if [ -f /storage/sdcard/nvtlogc ]; then
#dump tombstone if existed
[ -d /data/tombstones ] && cp -R /data/tombstones /storage/sdcard
#start logging to sd card
echo "logging to external storage - SD card"
[ -d /storage/sdcard/nvtlog ] || mkdir /storage/sdcard/nvtlog
logcat -v time -f /storage/usbdisk/nvtlog/log -r 1024 -n 50
fi
#If nvtlog is existed in EMMC
if [ -f /data/nvtlogc ]; then
#start logging to emmc
echo "logging to embedded storage"
[ -d /data/nvtlog ] || mkdir /data/nvtlog
logcat -v time -f /data/nvtlog/log -r 1024 -n 4
fi