TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2017 |
Maintained by Joe Barbour.
GDLogger is a lightweight class logging class for iOS versions 3.0 and above, build for Grado. It allows for quick, strightforward creation, and appending of multiple, formatted log files.
pod 'GDLogger'
Add #import "GDLogger/GDLogger.h"
In your .m file add GDLogger *logger = [[GDLogger alloc] init];
logger.degbugger = true;
logger.filename = @"my-new-log";
NOTE To revert back to the default log file set logger.filename = nil;
NOTE Do not include the file type when setting logger.filename
title (NSString
properties (NSDictionary)
[logger log:@"Event Title" properties:@{@"key":@"value", @"installed":[NSNumber numberWithBool:true]}];
logger.logPrint
Alternatively, you can get the file content as NSData logger.logData
NOTE this will print out the default log file unless logger.filename
has been set
logger.logPrint
Or, you can get an array of all files by calling
[self.logger logFiles:true]
(This will return the all the files with their full directories as NSURL)
[self.logger logFiles:false]
(This will return the all the files with just their respective file names as NSString)
[self logDestory];
will destory the active log file.
MFMailComposeViewController *emailController = [[MFMailComposeViewController alloc] init]; [emailController setMailComposeDelegate:self]; [emailController setToRecipients:[[NSArray alloc] initWithObjects:@"[email protected]", nil]]; [emailController setSubject:@"Log File"]; [emailController setMessageBody:@"" isHTML:false]; [emailController addAttachmentData:[logger logData] mimeType:@"text/plain" fileName:@"logger.txt"]; [emailController setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; [self presentViewController:emailController animated:true completion:nil];
NOTE the fileName for addAttachmentData can be anything