日志数据相关接口

日志埋点

通过设置日志埋点后可在基调听云报表平台配置「日志回捞」任务获取埋点日志信息;需引入TingyunLog.xcframework,具体见部署文档。

tag长度限制 128,日志内容长度限制 4096

  • 示例
    // 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)


    // 批量替换NSLog
    #define NSLog(format,...)  TINGYUNAPP_LOG_DEBUG(@"tag",format,##__VA_ARGS__)

    // 批量替换printf
    #define printf(format,..)  TINGYUNAPP_LOG_DEBUG_C("tag",format,##__VA_ARGS__)

日志输出

调用后可将埋点日志输出到控制台。

  • 相关接口
/**
 * 打印日志
 */
+ (void)enableConsoleLog;
  • 代码示例
[NBSAppAgent enableConsoleLog];
© 2007-2024 北京基调网络股份有限公司 all right reserved,powered by Gitbook本文档更新于: 2024-03-04 10:18

results matching ""

    No results matching ""