全部产品
存储与CDN 数据库 安全 应用服务 数加·人工智能 数加·大数据基础服务 互联网中间件 视频服务 开发者工具 解决方案 物联网 钉钉智能硬件
日志服务

iOS SDK

更新时间:2017-11-28 15:54:56

简介

阿里云日志服务SDK基于API实现,目前提供以下功能:

  • 写入日志

GitHub地址:

Swift:

  1. /*
  2. 通过EndPoint、accessKeyID、accessKeySecret 构建日志服务客户端
  3. @endPoint: 服务访问入口,参见 https://help.aliyun.com/document_detail/29008.html
  4. */
  5. let myClient = try! LOGClient(endPoint: "",
  6. accessKeyID: "",
  7. accessKeySecret: "",
  8. projectName:"")
  9. /* 创建logGroup */
  10. let logGroup = try! LogGroup(topic: "mTopic",source: "mSource")
  11. /* 存入一条log */
  12. let log1 = Log()
  13. try! log1.PutContent("K11", value: "V11")
  14. try! log1.PutContent("K12", value: "V12")
  15. try! log1.PutContent("K13", value: "V13")
  16. logGroup.PutLog(log1)
  17. /* 存入一条log */
  18. let log2 = Log()
  19. try! log2.PutContent("K21", value: "V21")
  20. try! log2.PutContent("K22", value: "V22")
  21. try! log2.PutContent("K23", value: "V23")
  22. logGroup.PutLog(log2)
  23. /* 发送 log */
  24. myClient.PostLog(logGroup,logStoreName: ""){ response, error in
  25. // handle response however you want
  26. if error?.domain == NSURLErrorDomain && error?.code == NSURLErrorTimedOut {
  27. print("timed out") // note, `response` is likely `nil` if it timed out
  28. }
  29. }

Objective-C:

参见Github:https://github.com/lujiajing1126/AliyunLogObjc

本文导读目录