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
9c8e14ab
Commit
9c8e14ab
authored
Oct 30, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 屏蔽阿里云日志
parent
13f676a9
Changes
2
Hide 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 @
9c8e14ab
...
...
@@ -106,7 +106,7 @@ target 'galaxy' do
#七鱼SDK
pod
'QY_iOS_SDK'
,
'9.7.0'
#阿里云日志
pod
'AliyunLogProducer'
,
'4.3.3'
#
pod 'AliyunLogProducer', '4.3.3'
end
...
...
galaxy/galaxy/Classes/Modules/AliYunLog(阿里云日志)/YHAliYunLogManager.swift
View file @
9c8e14ab
////
//// YHAliYunLogManager.swift
//// galaxy
////
//// Created by edy on 2024/10/29.
//// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
////
//
//
YHAliYunLogManager.swif
t
//
galaxy
//
import UIKi
t
//
import AliyunLogProducer
//
// Created by edy on 2024/10/29.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//enum YHAliYunLogKey: String {
//
// case moduleNameNetworkDataType = "moduleName-networkDataType" // 网络数据
// case moduleNameH5InteractionType = "moduleName-h5InteractionType" // 与H5交互相关
// case moduleNameClickType = "moduleName-clickType" // 用户点点击事件
//
// case mobile = "mobile" // 当前登录用户的手机号码
// case remark = "remark" // 可以随意上传内容
// case timestamp = "timestamp" // 时间戳
// case app_platform = "app_platform" // 系统、平台
// case app_version = "app_version" // app版本号
// case app_channel = "app_channel"
// case app_phoneModel = "app_phoneModel" // 手机型号
// case os_version_name = "os_version_name" // 操作系统版本号
//}
//
import
UIKit
import
AliyunLogProducer
enum
YHAliYunLogKey
:
String
{
case
moduleNameNetworkDataType
=
"moduleName-networkDataType"
// 网络数据
case
moduleNameH5InteractionType
=
"moduleName-h5InteractionType"
// 与H5交互相关
case
moduleNameClickType
=
"moduleName-clickType"
// 用户点点击事件
case
mobile
=
"mobile"
// 当前登录用户的手机号码
case
remark
=
"remark"
// 可以随意上传内容
case
timestamp
=
"timestamp"
// 时间戳
case
app_platform
=
"app_platform"
// 系统、平台
case
app_version
=
"app_version"
// app版本号
case
app_channel
=
"app_channel"
case
app_phoneModel
=
"app_phoneModel"
// 手机型号
case
os_version_name
=
"os_version_name"
// 操作系统版本号
}
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
)
}
}
//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)
// }
//}
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