该工具可通过下载源码后,在sclog/dist
目录下执行以下命令安装:
pip3 install sclog-1.0.tar.gz
安装输入输出,若显示Successfully installed sclog-1.0
表示安装成功:
➜ dist pip3 install sclog-1.0.tar.gz
Processing ./sclog-1.0.tar.gz
Preparing metadata (setup.py) ... done
Installing collected packages: sclog
DEPRECATION: sclog is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for sclog ... done
Successfully installed sclog-1.0
该工具主要应用于安卓车机进行debug调试时,发现了error/crash时,考虑复现对车机录屏和日志抓取功能,并将日志和录屏文件进行打包压缩,复现前打开cmd终端输入sclog
即可运行该脚本。
def main():
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
logcat_filename = "logcat_{}.log".format(timestamp)
output_filename = "video_{}.mp4".format(timestamp)
zip_filename = "logs_and_screen_{}.zip".format(timestamp)
record_screen(logcat_filename, output_filename)
create_zip(logcat_filename, output_filename, zip_filename)
(1)获取当前时间
(2)在当前目录创建logcat_{当前时间}.log
日志文件
(3)在当前目录创建video_{当前时间}.mp4
录屏文件
(4)将日志文件和录屏文件压缩至logs_and_screen_{当前时间}.zip
压缩文件