Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened his eyes.
为了尽量复用代码,这个项目中的某些组件之间有比较强的依赖关系。为了方便其他开发者使用,我从中拆分出以下独立组件:
- Log4G — Simple, lightweight logging framework written in Swift.
- AssistiveButton — Simple Assistive Button.
- AppBaseKit — A handy kit of Swift extensions and wrapped class to boost your productivity.
- AppSwizzle — lightweight and flexible method swizzling wrapped by swift.
- LeakEye — LeakEye is a memory leak monitor.
- NetworkEye — NetworkEye is a network monitor,automatic catch the request and response infomation of all kinds of request send.
- ANREye — ANREye is an ANR (Application Not Responding) monitor,automatic catch the ANR and return stacktrace of all threads.
- ASLEye — ASLEye is an ASL(Apple System Log) monitor, automatic catch the log from NSLog by asl module.
- CrashEye — CrashEye is an ios crash monitor,automatic catch exception crash & signal crash and return the stacktrace.
- SystemEye — SystemEye is a system monitor,automatic catch the infomation of cpu,memory....etc.
- 监控日志并区分日志类型.
- 监控崩溃, 包括Uncatched Exception和Signal崩溃.
- 监控网络, 包括请求和响应的所有信息.
- 监控卡顿, 并告诉你卡顿时候的所有线程的堆栈.
- 监控内存泄露, 告诉你泄露的对象的类名.
- 提供一个可以自定义指令和输出的控制台.
- 监控系统和应用自身的CPU使用率.
- 监控系统与应用自身的内存使用率.
- 监控帧率FPS.
- 监控系统和应用自身的网络流量.
- 提供一个文件浏览器可用于查看沙盒,.app 以及系统根目录的文件.
- 运行时自定义设置
- 丰富: 功能全面
- 方便: 一行代码接入
- 自动: 零代码入侵
- 安全: Release包可不打入一行代码
GodEye目前可以通过 CocoaPods来安装.只需要将下面的代码加入到你的Podfile中即可:
pod "GodEye"CocoaChinaPlus是一款用Swift编写的开源的CocoaChina第三方客户端,目前已经接入GodEye,并且可以很好的工作。
笔者写了一本书,名叫《iOS监控编程》,每个章节记录了功能的实现细节,以及笔者一路探索的心路历程。当然,笔者后续依旧会寻求与探索新的监控方向,一旦有所得都会更新到本书的章节中.
在AppDelegate中用下面的代码导入进来:
import GodEye然后在 application:didFinishLaunchingWithOptions初始化GodEye:
GodEye.makeEye(with:self.window!)当然,一行代码接入是一种默认配置的接入,读者也可以通过传入自己的Configuration来精细化配置各个细节:
let configuration = Configuration()
configuration.command.add(command: "test", description: "test command") { () -> (String) in
return "this is test command result"
}
configuration.command.add(command: "info", description: "print test info") { () -> (String) in
return "info"
}
GodEye.makeEye(with: self.window!, configuration: configuration)上面的示例是自定义命令的配置,我们也可以自定义control和switch的配置,详细的配置项可以看ControlConfiguration 和 SwitchConfiguration两个类。
clone这个库,在Example目录下运行pod install就可以跑工程自带的示例工程了。
twitter: @zixun_
email: chenyl.exe@gmail.com
github: zixun
blog: 子循(SubCycle)
首先需要感谢的是开源社区Github,它给了我很多思路和灵感,甚至现成的代码:
- 日志监控灵感源于AELog:https://github.com/tadija/AELog;
- 崩溃监控灵感源于GT:https://github.com/Tencent/GT;
- 卡顿监控灵感源于Watchdog:https://github.com/wojteklu/Watchdog;
- 网络监控灵感源于NetworkEye:https://github.com/coderyi/NetworkEye;
其次要感谢的是全球最大的技术问答社区StackOverFlow,它解答了笔者写作与开发中很多遇到的问题,以下列出几个映象深刻的:
- 应用的CPU使用率:ios-get-cpu-usage-from-application;
- 系统的CPU使用率: get-cpu-percent-usage
然后要感谢的是几位大牛的博客:
- 内存泄漏灵感源于MrPeak的PLeakSniffer:http://mrpeak.cn/blog/leak
- 微信阅读团队MLeaksFinder:https://wereadteam.github.io/2016/02/22/MLeaksFinder
GodEye开源在 MIT 协议下,详细请查看 LICENSE 文件。










