Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
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
杨凯
YDL-Component-Medical
Commits
3507c44d
Commit
3507c44d
authored
Mar 31, 2021
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 加入阿里云日志,封装工具类
parent
6f71c519
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
3 deletions
+78
-3
config.gradle
config.gradle
+2
-2
build.gradle
ydl-platform/build.gradle
+3
-1
AliYunLogConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/log/AliYunLogConfig.kt
+23
-0
AliYunLogHelper.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/log/AliYunLogHelper.kt
+50
-0
No files found.
config.gradle
View file @
3507c44d
...
...
@@ -33,7 +33,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform"
:
"0.0.39.
89
"
,
"ydl-platform"
:
"0.0.39.
95
"
,
//第二步 若干
"ydl-webview"
:
"0.0.38.36"
,
...
...
@@ -115,7 +115,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform"
:
"0.0.39.
89
"
,
"ydl-platform"
:
"0.0.39.
95
"
,
//第二步 若干
"ydl-webview"
:
"0.0.38.36"
,
...
...
ydl-platform/build.gradle
View file @
3507c44d
...
...
@@ -72,10 +72,12 @@ dependencies {
testImplementation
'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
api
'com.aliyun.openservices:aliyun-log-android-sdk:2.5.13'
//====================YDL Repository====================
// api rootProject.ext.dependencies["ydl-pushagent"]
// api rootProject.ext.dependencies["ydl-hnet"]
api
(
rootProject
.
ext
.
dependencies
[
"ydl-notracepoint"
])
{
api
(
rootProject
.
ext
.
dependencies
[
"ydl-notracepoint"
])
{
transitive
=
true
exclude
group:
'com.google.code.gson'
,
module:
'gson'
exclude
group:
'com.squareup.okhttp3'
,
module:
'okhttp3'
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/log/AliYunLogConfig.kt
0 → 100644
View file @
3507c44d
package
com.ydl.ydlcommon.utils.log
object
AliYunLogConfig
{
/**接口*/
const
val
API
=
"API"
/**声网*/
const
val
AGORA
=
"Agora"
/**登录*/
const
val
LOGIN
=
"Login"
/**WebView*/
const
val
WEB
=
"Web"
/**支付*/
const
val
PAY
=
"Pay"
/**其他*/
const
val
OTHER
=
"Other"
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/log/AliYunLogHelper.kt
0 → 100644
View file @
3507c44d
package
com.ydl.ydlcommon.utils.log
import
android.util.Log
import
com.aliyun.sls.android.producer.*
class
AliYunLogHelper
{
companion
object
{
var
mConfig
:
LogProducerConfig
?
=
null
var
mClient
:
LogProducerClient
?
=
null
fun
getInstance
():
AliYunLogHelper
{
return
Holder
.
INSTANCE
}
}
constructor
()
{
val
endpoint
=
"cn-hangzhou.log.aliyuncs.com"
val
project
=
"ydl-app-log"
val
logstore
=
"ydl-app-log"
val
accesskeyid
=
"LTAI5tH6WGqWUqzo4u5GfrCS"
val
accesskeysecret
=
"uzccm79mr9d4rIsABu3xwfbdUdaeWT"
try
{
mConfig
=
LogProducerConfig
(
endpoint
,
project
,
logstore
,
accesskeyid
,
accesskeysecret
)
mClient
=
LogProducerClient
(
mConfig
)
}
catch
(
e
:
LogProducerException
)
{
e
.
printStackTrace
()
}
}
private
object
Holder
{
val
INSTANCE
=
AliYunLogHelper
()
}
/**
*
* @param key AliYunLogConfig 接口、登录、声网、WebView、支付、其他
* @param value 具体的状态值
* */
fun
sendLog
(
key
:
String
,
value
:
String
)
{
val
log
=
Log
()
log
.
putContent
(
key
,
value
)
if
(
mClient
!=
null
)
{
val
res
:
LogProducerResult
=
mClient
!!
.
addLog
(
log
)
Log
.
d
(
"LogProducerResult"
,
String
.
format
(
"%s %s"
,
res
,
res
.
isLogProducerResultOk
))
}
}
}
\ No newline at end of file
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