测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可 | MIT |
发布最后发布 | 2017年6月 |
由 Zoeb Sheikh 维护。
依赖 | |
Realm | >= 0 |
KSCrash | >= 0 |
SMobiLogger 是一个日志库,提供从 iOS 设备收集的日志以及电子邮件日志功能。
要使用 CocoaPods 将 SMobiLog 集成到您的 Xcode 项目中,请在您的 Podfile
中指定它
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'TargetName' do
pod 'SMobiLog'
end
然后,运行以下命令
$ pod install
SMobiLog 版本 | 最小 iOS 目标 | 注意 |
---|---|---|
0.1.5 | iOS 8 | 一些错误修复。 |
0.1.4 | iOS 8 | 集成 KSCrash 报告。 |
0.1.3 | iOS 8 | 处理未捕获的异常。 |
0.1.2 | iOS 8 | 需要 Xcode 8+。最小 iOS 版本支持已更改。 |
0.1.0 | iOS 9.3 | 包含 Realm 支持。最小 iOS 版本支持为 9.3 |
objective-c
在 Appdelegate 的 didFinishLaunchingWithOptions:
中启动 MobiLogger
[[SMobiLogger sharedInterface] startMobiLogger]
它将清除旧日志(目前它存储保留日志的天数,可以从 plist 中更改),初始化 Realm
在 Appdelegate 的 didFinishLaunchingWithOptions:
中根据您的需要调用以下任一方法:
- (KSCrashInstallation *)installKSCrashWithURL:(NSString *)urlPath;
- (KSCrashInstallation *)installKSCrashWithEmails:(NSArray *)emails;
- (KSCrashInstallation *)installKSCrashWithURL:(NSString *)urlPath withAlert:(BOOL)showAlert;
- (KSCrashInstallation *)installKSCrashWithEmails:(NSArray *)emails withAlert:(BOOL)showAlert;
以下类型可用于区分日志消息。
Debug,
Error,
Crash,
Information,
Warning,
Other
Info 类型
[[SMobiLogger sharedInterface] info:@"Application Became Active ." withDescription:[NSString stringWithFormat:@"At: %s. \n \n", __FUNCTION__]];
Error 类型
[[SMobiLogger sharedInterface] error:@"Network Status:" withDescription:@"Unavailable"];
您可以根据需要使用任意的 logType。
要从数据库中获取所有日志
NSString *fetchLogString = [[SMobiLogger sharedInterface] fetchLogs];
要通过电子邮件发送日志(传入您想在上面显示 MFMailComposeViewController
的 UIViewController
)
- (void)sendEmailLogs:(id)controller;
SMobiLog 由 Systango Ltd 拥有和维护。
如果您认为已发现SMobiLog的安全漏洞,请尽快通过电子邮件报告,发送至 [email protected]。同时,请将其发布到问题跟踪器。
SMobiLog是在MIT许可证下发布的。请参阅LICENSE文件以获取详细信息。