SMobiLogger is a logger library, which provides logs, crash reports from iOS device along with email logs facility.
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like 'SMobiLog' in your projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 0.39.0+ is required to build SMobiLog 0.1.0+.
To integrate SMobiLog into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'TargetName' do
pod 'SMobiLog'
end
Then, run the following command:
$ pod install
SMobiLog Version | Minimum iOS Target | Notes |
---|---|---|
0.2.0 | iOS 8 | Get callback with crash report, if app crashed last time |
0.1.5 | iOS 8 | Few bug fixes. |
0.1.4 | iOS 8 | Integrated KSCrash reporting. |
0.1.3 | iOS 8 | Handle Uncaught exceptions. |
0.1.2 | iOS 8 | Xcode 8+ is required. Minimum iOS version support has been changed. |
0.1.0 | iOS 9.3 | Realm support is included. Minimum iOS version support is 9.3 |
objective-c
In Appdelegate's didFinishLaunchingWithOptions:
start MobiLogger
[[SMobiLogger sharedInterface] startMobiLogger]
It will clear old logs(currently it stores logs for 2 days, which can be changed from plist), initialise Realm
In Appdelegate's didFinishLaunchingWithOptions:
call any one of the following method as per your need
- (KSCrashInstallation *)installKSCrashConsoleWithCompletionBlock:(smobiCompletionBlock)block;
- (KSCrashInstallation *)installKSCrashWithURLString:(NSString *)urlPath withCompletionBlock:(smobiCompletionBlock)block;
- (KSCrashInstallation *)installKSCrashWithEmails:(NSArray *)emails withCompletionBlock:(smobiCompletionBlock)block;
- (KSCrashInstallation *)installKSCrashConsoleWithAlert:(BOOL)showAlert withCompletionBlock:(smobiCompletionBlock)block;
- (KSCrashInstallation *)installKSCrashWithURLString:(NSString *)urlPath withAlert:(BOOL)showAlert withCompletionBlock:(smobiCompletionBlock)block;
- (KSCrashInstallation *)installKSCrashWithEmails:(NSArray *)emails withAlert:(BOOL)showAlert withCompletionBlock:(smobiCompletionBlock)block;
Following types are available to differentiate log messages.
Debug,
Error,
Crash,
Information,
Warning,
Other
Info Type:
[[SMobiLogger sharedInterface] info:@"Application Became Active ." withDescription:[NSString stringWithFormat:@"At: %s. \n \n", __FUNCTION__]];
Error Type:
[[SMobiLogger sharedInterface] error:@"Network Status:" withDescription:@"Unavailable"];
You can use any logType as per your need.
To Fetch all the logs from db
NSString *fetchLogString = [[SMobiLogger sharedInterface] fetchLogs];
To send logs via email (Pass your UIViewController
on which you want to present MFMailComposeViewController
)
- (void)sendEmailLogsWithRecipients:(NSArray *)recipients;
SMobiLog is owned and maintained by the Systango Ltd.
If you believe you have identified a security vulnerability with SMobiLog, you should report it as soon as possible via email to zoeb@systango.com. Also please post it to a issue tracker.
SMobiLog is released under the MIT license. See LICENSE for details.