Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
9a217cf3
Commit
9a217cf3
authored
Oct 30, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 阿里云日志
parent
749ff8b5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
86 deletions
+86
-86
Podfile
galaxy/Podfile
+1
-1
YHAliYunLogManager.swift
...Classes/Modules/AliYunLog(阿里云日志)/YHAliYunLogManager.swift
+85
-85
No files found.
galaxy/Podfile
View file @
9a217cf3
...
@@ -106,7 +106,7 @@ target 'galaxy' do
...
@@ -106,7 +106,7 @@ target 'galaxy' do
#七鱼SDK
#七鱼SDK
pod
'QY_iOS_SDK'
,
'9.7.0'
pod
'QY_iOS_SDK'
,
'9.7.0'
#阿里云日志
#阿里云日志
#
pod 'AliyunLogProducer', '4.3.3'
pod
'AliyunLogProducer'
,
'4.3.3'
end
end
...
...
galaxy/galaxy/Classes/Modules/AliYunLog(阿里云日志)/YHAliYunLogManager.swift
View file @
9a217cf3
////
//// YHAliYunLogManager.swift
//// galaxy
////
//// Created by edy on 2024/10/29.
//// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
////
//
//
//
import UIKi
t
//
YHAliYunLogManager.swif
t
//
import AliyunLogProducer
//
galaxy
//
//
//enum YHAliYunLogKey: String {
// Created by edy on 2024/10/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
//
// case moduleNameNetworkDataType = "moduleName-networkDataType" // 网络数据
// case moduleNameH5InteractionType = "moduleName-h5InteractionType" // 与H5交互相关
import
UIKit
// case moduleNameClickType = "moduleName-clickType" // 用户点点击事件
import
AliyunLogProducer
//
// case mobile = "mobile" // 当前登录用户的手机号码
enum
YHAliYunLogKey
:
String
{
// case remark = "remark" // 可以随意上传内容
// case timestamp = "timestamp" // 时间戳
case
moduleNameNetworkDataType
=
"moduleName-networkDataType"
// 网络数据
// case app_platform = "app_platform" // 系统、平台
case
moduleNameH5InteractionType
=
"moduleName-h5InteractionType"
// 与H5交互相关
// case app_version = "app_version" // app版本号
case
moduleNameClickType
=
"moduleName-clickType"
// 用户点点击事件
// case app_channel = "app_channel"
// case app_phoneModel = "app_phoneModel" // 手机型号
case
mobile
=
"mobile"
// 当前登录用户的手机号码
// case os_version_name = "os_version_name" // 操作系统版本号
case
remark
=
"remark"
// 可以随意上传内容
//}
case
timestamp
=
"timestamp"
// 时间戳
//
case
app_platform
=
"app_platform"
// 系统、平台
//class YHAliYunLogManager {
case
app_version
=
"app_version"
// app版本号
//
case
app_channel
=
"app_channel"
// static let SLS_ENDPOINT = "cn-shenzhen.log.aliyuncs.com"
case
app_phoneModel
=
"app_phoneModel"
// 手机型号
// static let SLS_PROJECT_DEV = "dev-yinhe-app"
case
os_version_name
=
"os_version_name"
// 操作系统版本号
// static let SLS_PROJECT_RELEASE = "release-yinhe-app"
}
// static let SLS_LOG_STORE = "yinhe_logstore"
// static let SLS_KEY = "LTAI5tPV7UEB2Dqyaippchbq"
class
YHAliYunLogManager
{
// static let SLS_SECRET = "K6AOXrVnLzb0Zn6HtHm9qFv8DfmEFv"
//
static
let
SLS_ENDPOINT
=
"cn-shenzhen.log.aliyuncs.com"
// static let shared = createManager()
static
let
SLS_PROJECT_DEV
=
"dev-yinhe-app"
// private var config: LogProducerConfig?
static
let
SLS_PROJECT_RELEASE
=
"release-yinhe-app"
// private var client: LogProducerClient?
static
let
SLS_LOG_STORE
=
"yinhe_logstore"
//
static
let
SLS_KEY
=
"LTAI5tPV7UEB2Dqyaippchbq"
// static private func createManager() -> YHAliYunLogManager {
static
let
SLS_SECRET
=
"K6AOXrVnLzb0Zn6HtHm9qFv8DfmEFv"
//
// let manager = YHAliYunLogManager()
static
let
shared
=
createManager
()
//#if DEBUG
private
var
config
:
LogProducerConfig
?
// let projectName = SLS_PROJECT_DEV
private
var
client
:
LogProducerClient
?
//#elseif TESTENV
// let projectName = SLS_PROJECT_DEV
static
private
func
createManager
()
->
YHAliYunLogManager
{
//#elseif UATENV
// let projectName = SLS_PROJECT_DEV
let
manager
=
YHAliYunLogManager
()
//#else
#if DEBUG
// let projectName = SLS_PROJECT_RELEASE
let
projectName
=
SLS_PROJECT_DEV
//#endif
#elseif TESTENV
//
let
projectName
=
SLS_PROJECT_DEV
// let config = LogProducerConfig(endpoint: SLS_ENDPOINT,
#elseif UATENV
// project: projectName,
let
projectName
=
SLS_PROJECT_DEV
// logstore: SLS_LOG_STORE,
#else
// accessKeyID: SLS_KEY,
let
projectName
=
SLS_PROJECT_RELEASE
// accessKeySecret: SLS_SECRET)
#endif
// // 设置日志主题
// config?.setTopic("example_topic")
let
config
=
LogProducerConfig
(
endpoint
:
SLS_ENDPOINT
,
// // 设置日志来源。
project
:
projectName
,
// config?.setSource("your new-source")
logstore
:
SLS_LOG_STORE
,
// // 设置tag信息,此tag信息将被附加在每条日志上。
accessKeyID
:
SLS_KEY
,
// config?.addTag("example", value: "example_tag")
accessKeySecret
:
SLS_SECRET
)
// // 是否丢弃过期日志。0表示不丢弃,把日志时间修改为当前时间; 1表示丢弃。默认值为1。
// 设置日志主题
// config?.setDropDelayLog(1)
config
?
.
setTopic
(
"example_topic"
)
// // 是否丢弃鉴权失败的日志,0表示不丢弃,1表示丢弃。默认值为0。
// 设置日志来源。
// config?.setDropUnauthorizedLog(0)
config
?
.
setSource
(
"your new-source"
)
// manager.config = config
// 设置tag信息,此tag信息将被附加在每条日志上。
// manager.client = LogProducerClient(logProducerConfig: config!)
config
?
.
addTag
(
"example"
,
value
:
"example_tag"
)
// return manager
// 是否丢弃过期日志。0表示不丢弃,把日志时间修改为当前时间; 1表示丢弃。默认值为1。
// }
config
?
.
setDropDelayLog
(
1
)
//
// 是否丢弃鉴权失败的日志,0表示不丢弃,1表示丢弃。默认值为0。
// func addLog(_ log: Log?) {
config
?
.
setDropUnauthorizedLog
(
0
)
// guard let log = log else {
manager
.
config
=
config
// print("Log is nil, not adding.")
manager
.
client
=
LogProducerClient
(
logProducerConfig
:
config
!
)
// return
return
manager
// }
}
//
// client?.add(log)
func
addLog
(
_
log
:
Log
?)
{
// }
guard
let
log
=
log
else
{
//
print
(
"Log is nil, not adding."
)
// func addLog() {
return
// let log = Log()
}
// log.putContent("银河移动开发组效忠宣言", value: "坚决拥护龙的领导,团结在龙的周围,凡是龙的决策,我们都坚决维护,凡是龙的指示,我们都始终不渝地遵循")
// client?.add(log)
client
?
.
add
(
log
)
// }
}
//}
func
addLog
()
{
let
log
=
Log
()
log
.
putContent
(
"银河移动开发组效忠宣言"
,
value
:
"坚决拥护龙的领导,团结在龙的周围,凡是龙的决策,我们都坚决维护,凡是龙的指示,我们都始终不渝地遵循"
)
client
?
.
add
(
log
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment