Log Retrieval
Log Instrumentationβ
After setting log instrumentation, you can configure "Log Retrieval" tasks in the Tingyun reporting platform to obtain instrumented log information. You need to import TingyunLog.xcframework, see the deployment documentation for details.
Tag length limit: 128, log content length limit: 4096.
- Example
// Objective-c
NSString *tag = @"tag";
NSString *fmt = @"content";
TINGYUNAPP_LOG_DEBUG(tag, @"debugInformation: %@",fmt);
TINGYUNAPP_LOG_INFO(tag, @"infoInformation: %@",fmt);
TINGYUNAPP_LOG_WARN(tag, @"warnInformation: %@",fmt);
TINGYUNAPP_LOG_ERROR(tag, @"errorInformation: %@",fmt);
// C/C++
char *content = "content";
char *Ctag = "tag";
TINGYUNAPP_LOG_DEBUG_C(Ctag,"debugInformation: %s",content);
TINGYUNAPP_LOG_INFO_C(Ctag, "infoInformation: %s",content);
TINGYUNAPP_LOG_WARN_C(Ctag, "warnInformation: %s",content);
TINGYUNAPP_LOG_ERROR_C(Ctag,"errorInformation: %s",content);
// swift
NBSAppAgent.debugLog("debugInformation", tag: "debugTag", fileName: "fileName", funcName: "functionName", line: 1)
NBSAppAgent.infoLog("infoInformation", tag: "infoTag", fileName: "fileName", funcName: "functionName", line: 2)
NBSAppAgent.warnLog("warnInformation", tag: "warnTag", fileName: "fileName", funcName: "functionName", line: 3)
NBSAppAgent.errorLog("errorInformation", tag: "errorTag", fileName: "fileName", funcName: "functionName", line: 4)
// Batch replace NSLog
#define NSLog(format,...) TINGYUNAPP_LOG_DEBUG(@"tag",format,##__VA_ARGS__)
// Batch replace printf
#define printf(format,..) TINGYUNAPP_LOG_DEBUG_C("tag",format,##__VA_ARGS__)
Log Outputβ
After calling, instrumented logs can be output to the console.
- Related API
/**
* Print logs
*/
+ (void)enableConsoleLog;
- Code Example
[NBSAppAgent enableConsoleLog];