Logging API

RevTwo logging functions allow logs to be stored, then viewed during a support session. The logging functions output using the native log functions so you can see them in the debug console, and still store the logs for later viewing. The log functions take a level parameter that lets a support tech filter by level. They also send logging output in real time during a session. The log history is 1000 deep.

RevTwo logging stores a timestamp and level. Trace is lowest, then debug, warn, and error is highest. In the support dashboard the tech can filter by level. Log entries will be displayed in real time on the support dashboard if a session is active.

  • Trace: This level is designed to show information messages showing how your app is running.
  • Debug: These logs will show information that would be useful when trying to debug your app.
  • Warning: This level shows potentially harmful situations.
  • Error: This level designates error events.

On iOS, Objective-C programmers use NSLog() typically. The R2Log() can substitute directly and it defaults to Warning level. The other functions allow logging with different levels.

void R2Log(NSString *format, ...);
void R2Error(NSString *format, ...);
void R2Warn(NSString *format, ...);
void R2Debug(NSString *format, ...);
void R2Trace(NSString *format, ...);

Just like NSLog(), these functions take a variable arg list to create a string.  For example:

#import "Revtwo.h"
...
R2Debug(@"called url %@ with code %d", url, returnCode);

Swift programmers use print() and it doesn’t need variable args because Swift can substitute values into a string. So we have

void R2Print(NSString *message, NSInteger level);

which is like using print() with an additional level parameter.

R2Print("called url \(url) with code \(returnCode)", LOGENTRY_WARNING);