Quick Start Guide

J. Yaunches edited this page Oct 6, 2015 · 5 revisions

With the JiffyLogger CocoaPod, an example app is provided to demonstrate usage. Check that out if example apps are your thing.

What JiffyLogger provides the ability to:

  1. Create different types of loggers with each storing their individual logs to separate files.
  2. Integrate a custom screen to view the logs for one particular logger. This screen incorporates the ability to trigger an export or a delete of that particular set of logs.

This guide will review how to setup both of these features.

Installation

JiffyLogger is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "JiffyLogger"

Creating a Logger

You create a new Logger by subclassing the base logger, JiffyLogger and having your version implement the JFLogExportProtocol protocol.

@interface YourExampleLogger : JFFileLogger<JFLogExportProtocol>
+ (JFCommunicationLogger *)shared; //singleton access method
@end

Loggers make the most sense to be set up as singletons so they can be accessed from anywhere to add new logs. You'll want to set yours up this way as well.

@implementation YourExampleLogger
+ (YourExampleLogger *)shared {
    static YourExampleLogger *logger = nil;
    if (!logger) {
        logger = [[JFCommunicationLogger alloc] initWithTimestamps:YES];
    }
    return logger;
}
...
@end

@end

You'll want to implement the methods that come along with the JFLogExportProtocol. These are as follows and are used for the exporting functionality that is included. If unimplemented the field will be left blank in the export email.

- (NSString *)exportFilename;
- (NSString *)subject;
- (NSString *)logDestinationEmail;
- (NSString *)messageBody;

Logging entries

[[YourExampleLogger shared] log:@"a log entry"];

Viewing a Logger's logs

It's as easy as instantiating the JFLogsViewController with the singleton instance of the logger you're interested in viewing.

JFLogsViewController *logsScreen = [[JFLogsViewController alloc] initWithLogger:[YourExampleLogger shared];

Once you have this, you can push it onto a navigation controller or embed it in another view. Whatever you need!

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.