Commit fa231adf authored by Steven杜宇's avatar Steven杜宇

// 阿里云日志接入

parent 443ba274
# Uncomment the next line to define a global platform for your project # Uncomment the next line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/aliyun-sls/Specs.git'
platform :ios, '13.0' platform :ios, '13.0'
target 'galaxy' do target 'galaxy' do
...@@ -104,6 +105,9 @@ target 'galaxy' do ...@@ -104,6 +105,9 @@ target 'galaxy' do
pod 'TYSnapshotScroll', '0.4.0' pod 'TYSnapshotScroll', '0.4.0'
#七鱼SDK #七鱼SDK
pod 'QY_iOS_SDK', '9.7.0' pod 'QY_iOS_SDK', '9.7.0'
#阿里云日志
pod 'AliyunLogProducer', '4.3.3'
end end
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
040450CF2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */; }; 040450CF2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */; };
0408C3632BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0408C3622BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift */; }; 0408C3632BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0408C3622BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift */; };
0409BEEB2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0409BEEA2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift */; }; 0409BEEB2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0409BEEA2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift */; };
04129E862CD0C8490072F87B /* YHAliYunLogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */; };
041390692C1081FA0098CB8A /* YHFileListEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */; }; 041390692C1081FA0098CB8A /* YHFileListEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */; };
0414708B2C88627B00B7B688 /* YHButlerServiceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */; }; 0414708B2C88627B00B7B688 /* YHButlerServiceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */; };
0414708E2C895A9300B7B688 /* YHButlerServiceViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708D2C895A9300B7B688 /* YHButlerServiceViewModel.swift */; }; 0414708E2C895A9300B7B688 /* YHButlerServiceViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0414708D2C895A9300B7B688 /* YHButlerServiceViewModel.swift */; };
...@@ -975,6 +976,7 @@ ...@@ -975,6 +976,7 @@
040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentMultiLineTipsCell.swift; sourceTree = "<group>"; }; 040450CE2CC8A0F400D1CFE5 /* YHResignDocumentMultiLineTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentMultiLineTipsCell.swift; sourceTree = "<group>"; };
0408C3622BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerControlView.swift; sourceTree = "<group>"; }; 0408C3622BEC7C6900DB1E25 /* YHVideoPlayerControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerControlView.swift; sourceTree = "<group>"; };
0409BEEA2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPrincipleProfileListCell.swift; sourceTree = "<group>"; }; 0409BEEA2C5B41D4003FCFD7 /* YHPrincipleProfileListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPrincipleProfileListCell.swift; sourceTree = "<group>"; };
04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAliYunLogManager.swift; sourceTree = "<group>"; };
041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListEmptyView.swift; sourceTree = "<group>"; }; 041390682C1081FA0098CB8A /* YHFileListEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListEmptyView.swift; sourceTree = "<group>"; };
0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceManager.swift; sourceTree = "<group>"; }; 0414708A2C88627B00B7B688 /* YHButlerServiceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceManager.swift; sourceTree = "<group>"; };
0414708D2C895A9300B7B688 /* YHButlerServiceViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceViewModel.swift; sourceTree = "<group>"; }; 0414708D2C895A9300B7B688 /* YHButlerServiceViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceViewModel.swift; sourceTree = "<group>"; };
...@@ -1948,6 +1950,14 @@ ...@@ -1948,6 +1950,14 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
04129E842CD0C8000072F87B /* AliYunLog(阿里云日志) */ = {
isa = PBXGroup;
children = (
04129E852CD0C8490072F87B /* YHAliYunLogManager.swift */,
);
path = "AliYunLog(阿里云日志)";
sourceTree = "<group>";
};
041470892C885EC900B7B688 /* ButlerServiceManager(银河管家) */ = { 041470892C885EC900B7B688 /* ButlerServiceManager(银河管家) */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -4870,6 +4880,7 @@ ...@@ -4870,6 +4880,7 @@
A5ACE91B2B4564F7002C94D2 /* Modules */ = { A5ACE91B2B4564F7002C94D2 /* Modules */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04129E842CD0C8000072F87B /* AliYunLog(阿里云日志) */,
041470892C885EC900B7B688 /* ButlerServiceManager(银河管家) */, 041470892C885EC900B7B688 /* ButlerServiceManager(银河管家) */,
A596CADD2C6B9AF200F85797 /* HomeAlertViewManager(首页弹窗管理) */, A596CADD2C6B9AF200F85797 /* HomeAlertViewManager(首页弹窗管理) */,
A5F886B22C61CDAA00B63CF5 /* PictureReview(图片预览) */, A5F886B22C61CDAA00B63CF5 /* PictureReview(图片预览) */,
...@@ -5648,6 +5659,7 @@ ...@@ -5648,6 +5659,7 @@
04A7BD0F2BA41C9800BD35A2 /* YHMyDocumentsModel.swift in Sources */, 04A7BD0F2BA41C9800BD35A2 /* YHMyDocumentsModel.swift in Sources */,
044EE24A2C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift in Sources */, 044EE24A2C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift in Sources */,
0449EEF02C902A4100A397FD /* YHResignMaterialUploadVC.swift in Sources */, 0449EEF02C902A4100A397FD /* YHResignMaterialUploadVC.swift in Sources */,
04129E862CD0C8490072F87B /* YHAliYunLogManager.swift in Sources */,
04174D642BCD52BD000BA46D /* YHDeviceInfoViewController.swift in Sources */, 04174D642BCD52BD000BA46D /* YHDeviceInfoViewController.swift in Sources */,
0472E25E2C534723008EAB6E /* YHLifeDetailViewController.swift in Sources */, 0472E25E2C534723008EAB6E /* YHLifeDetailViewController.swift in Sources */,
0457920D2CBCE8A800EBD99B /* YHResignUploadTravelCardListModel.swift in Sources */, 0457920D2CBCE8A800EBD99B /* YHResignUploadTravelCardListModel.swift in Sources */,
......
//
// YHAliYunLogManager.swift
// galaxy
//
// Created by edy on 2024/10/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AliyunLogProducer
class YHAliYunLogManager {
static let SLS_ENDPOINT = "cn-shenzhen.log.aliyuncs.com"
static let SLS_PROJECT_DEV = "dev-yinhe-app"
static let SLS_PROJECT_RELEASE = "release-yinhe-app"
static let SLS_LOG_STORE = "yinhe_logstore"
static let SLS_KEY = "LTAI5tPV7UEB2Dqyaippchbq"
static let SLS_SECRET = "K6AOXrVnLzb0Zn6HtHm9qFv8DfmEFv"
static let shared = createManager()
private var config: LogProducerConfig?
private var client: LogProducerClient?
static private func createManager() -> YHAliYunLogManager {
let manager = YHAliYunLogManager()
#if DEBUG
let projectName = SLS_PROJECT_DEV
#elseif TESTENV
let projectName = SLS_PROJECT_DEV
#elseif UATENV
let projectName = SLS_PROJECT_DEV
#else
let projectName = SLS_PROJECT_RELEASE
#endif
let config = LogProducerConfig(endpoint: SLS_ENDPOINT,
project: projectName,
logstore: SLS_LOG_STORE,
accessKeyID: SLS_KEY,
accessKeySecret: SLS_SECRET)
// 设置日志主题
config?.setTopic("example_topic")
// 设置日志来源。
config?.setSource("your new-source")
// 设置tag信息,此tag信息将被附加在每条日志上。
config?.addTag("example", value: "example_tag")
// 是否丢弃过期日志。0表示不丢弃,把日志时间修改为当前时间; 1表示丢弃。默认值为1。
config?.setDropDelayLog(1)
// 是否丢弃鉴权失败的日志,0表示不丢弃,1表示丢弃。默认值为0。
config?.setDropUnauthorizedLog(0)
manager.config = config
manager.client = LogProducerClient(logProducerConfig: config!)
return manager
}
func addLog(_ log: Log?) {
guard let log = log else {
print("Log is nil, not adding.")
return
}
client?.add(log)
}
func addLog() {
let log = Log()
log.putContent("银河移动开发组效忠宣言", value: "坚决拥护龙的领导,团结在龙的周围,凡是龙的决策,我们都坚决维护,凡是龙的指示,我们都始终不渝地遵循")
client?.add(log)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment