View on GitHub

Logboy

Logboy是一个日志管理库,可以本地控制台输出日志亦可远程输出

Download this project as a .zip file Download this project as a tar.gz file

Logboy

关于:

Logboy是一个日志管理库,可以本地控制台输出日志亦可远程输出, 通过搭建本地的Python环境,可以在本地浏览器查看输出的日志.

使用:

  1. 首先本地搭建python环境,这里使用时轻量级的web.py作为本地的服务器:

    • Mac & Windows,配置Python开发环境(Mac系统自带Python环境)
    • 下载:wget http://webpy.org/static/web.py-0.37.tar.gz
    • 解压,进入目录,安装:python setup.py install
    • 然后运行Android工程中python目录下的logconsole.py, 访问http://localhost:8080/
  2. Android项目使用:

    compile 'me.chunsheng.logboy:logboy:1.0.2'

    在Application或者Activity的OnCreate方法初始化:

    //初始化如下:输入自己的IP+port
    LogBoy.setRemoteUrl("http://192.168.1.108:8080/");
    LogBoy.init(this);
    
    //输出日志,和系统使用方法一样,分Tag ,Msg 以及日志级别(DEBUG|INFO|WARNING|ERROR)
    LogBoy.d("TagBoyD::", i + "Man cannot discover new oceans unless he has courage to lose sight of the shore. —Gide");
    LogBoy.w("TagBoyW::", i + "Towering genius disdains a beaten path. It seeks regions hitherto unexplored. —Lincoln ");
    LogBoy.e("TagBoyE:", i + "Tomorrow is never clear. Our time is here.");

有图有真相

下面截图包含demo运行和本地浏览器两部分:

  1. 工程demo运行效果图:

远程服务器运行效果图:

License

LogBoy is made available under the Apache-2.0

Support or Contact

Having trouble with LogBoy?Contact support and I’ll help you sort it out.