Please click here to read the new policy changes for the TestFlight SDK.The TestFlight SDK also includes remote logging. Regular NSLog statements are logged go to the console. TestFlight's remote logging allows you to see all the logs created by your users at testflightapp.com remotely. It also logs to the console like NSLog.
To perform remote logging you can use the TFLog method which logs using a number of different methods described below. In order to make the transition from NSLog to TFLog easy we have used the same method signature for TFLog as NSLog. You can easily switch over to TFLog by adding the following macro to your precompiled header (.pch) file.
#define NSLog TFLog
This will pass any NSLog statements to the TFLog function instead. if you want more information, such as file name and line number you can use a macro like
#define NSLog(__FORMAT__, ...) TFLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
Which will produce output in the following format:
-[HTFCheckpointsController showYesNoQuestion:] [Line 45] Pressed YES/NO
The TestFlight logger writes its data to a file which is then sent to our servers on Session End events. The Apple System Logger sends its messages to the Apple System Log and are viewable using the Organizer in Xcode when the device is attached to your computer. The ASL logger can be disabled by turning it off in your TestFlight options
[TestFlight setOptions:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"logToConsole"]];
The default option is YES.
The STDERR logger sends log messages to STDERR so that you can see your log statements while debugging. The STDERR logger is only active when a debugger is attached to your application. If you do not wish to use the STDERR logger you can disable it by turning it off in your TestFlight options
[TestFlight setOptions:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"logToSTDERR"]];
The default option is YES.
Advanced Remote Logging
We have implemented three different loggers.
1. TestFlight logger 2. Apple System Log logger 3. STDERR logger
For most users we expect using TFLog to provide all of the logging functionality that they need. For the occasion where you need to provide a wrapper around TFLog we provide:
void TFLogv(NSString *format, va_list arg_list);
Using TFLogv you can have your method that accepts a variable number of arguments that then passes that format and argument list to TFLog.
NOTE: The logs are collected while the app is running. They are sent at session end time or on crash, they are not coming in live. Sometimes they don't get sent in time. In this case, they are sent on the next startup. Sometimes those might not get sent because there is no internet or for any number of other reason. We will keep trying to send them but they may not be sent immediately.
Once sessions are collected from your app, you will be able to access the remote logs within the build's sessions or crashes page. Click here to learn how to view remote logs.