Skip to main content

Log Data Related Interfaces

Log Embedding​

After setting the log embedding, you can retrieve the embedded log information through the 'Log Retrieval' task configured on the Tingyun platform; you need to include TingyunLog.xcframework, see the deployment documentation for details.

The tag length is limited to 128, and the log content length is limited to 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 replacement NSLog
#define NSLog(format,...) TINGYUNAPP_LOG_DEBUG(@"tag",format,##__VA_ARGS__)

// Batch replacement printf
#define printf(format,..) TINGYUNAPP_LOG_DEBUG_C("tag",format,##__VA_ARGS__)

Log Output​

After the call, the embedded log can be output to the console.

  • Related Interface
/**
* Print log
*/
+ (void)enableConsoleLog;
  • Code Example
[NBSAppAgent enableConsoleLog];