1 # -*- coding:utf-8 -*-
 2 import os
 3 import time
 4 from common import Common
 5 comm = Common()
 6 
 7 cmd = r'adb logcat -v time -b main -b radio -b system >'
 8 for i in range(3):
 9     fn = r'../run_log/logcat' + str(i) + '.log'
10     os.popen(cmd+fn)
11     pid = comm.getAppPid('logcat')
12     while True:
13         fs = round(os.path.getsize(fn)/float(1024*1024),2)
14         time.sleep(1)
15         print ("当前文件的大小为:%s MB" %fs)
16         if fs >= 1:
17             kill_cmd = 'adb shell kill ' + pid
18             os.popen(kill_cmd)
19             break
20     print ("当前的日志文件为:%s" %fn)
21  

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。