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
5b638bfd
Commit
5b638bfd
authored
Apr 13, 2020
by
严久程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
声网日志
parent
a97bba19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
16 deletions
+40
-16
AudioLogUtils.kt
m-audioim/src/main/java/com/ydl/audioim/utils/AudioLogUtils.kt
+18
-16
LogHelper.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/log/LogHelper.kt
+22
-0
No files found.
m-audioim/src/main/java/com/ydl/audioim/utils/AudioLogUtils.kt
View file @
5b638bfd
...
...
@@ -29,10 +29,10 @@ class AudioLogUtils {
@SuppressLint
(
"SimpleDateFormat"
)
private
val
format
=
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
)
fun
writeAgoraLog
(
content
:
String
,
fileName
:
String
)
{
fun
writeAgoraLog
(
content
:
String
,
fileName
:
String
,
isAppend
:
Boolean
=
true
)
{
Observable
.
create
<
Any
>
{
try
{
writeLog
(
content
,
fileName
)
writeLog
(
content
,
fileName
,
isAppend
)
if
(
BuildConfig
.
DEBUG
)
{
LogUtil
.
d
(
"writeLog_complete"
)
}
...
...
@@ -42,7 +42,7 @@ class AudioLogUtils {
.
subscribe
()
}
private
fun
writeLog
(
content
:
String
,
fileName
:
String
)
{
private
fun
writeLog
(
content
:
String
,
fileName
:
String
,
isAppend
:
Boolean
)
{
try
{
val
folder
=
getLogFolder
()
val
file
=
File
(
folder
,
fileName
)
...
...
@@ -51,19 +51,21 @@ class AudioLogUtils {
}
val
fileWriter
=
FileWriter
(
file
,
true
)
val
writer
=
BufferedWriter
(
fileWriter
)
writer
.
write
(
"""Time:${format.format(Calendar.getInstance().time)}"""
)
writer
.
newLine
()
writer
.
write
(
"UserUid = ${ModularServiceManager.getPlatformUserService()?.getUser()?.userId}"
)
writer
.
newLine
()
writer
.
write
(
"""Network:${RxNetTool.getNetWorkTypeName(BaseApp.getApp())}"""
)
writer
.
newLine
()
writer
.
write
(
"""DevicesInfo:${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()}"""
)
writer
.
newLine
()
writer
.
write
(
"""VersionInfo:${RxAppTool.getAppVersionName(BaseApp.getApp())}"""
)
writer
.
newLine
()
writer
.
write
(
"AgoraLog:$content"
)
writer
.
newLine
()
writer
.
write
(
"--------"
)
if
(!
isAppend
)
{
writer
.
write
(
"----------------"
)
writer
.
newLine
()
writer
.
write
(
"""Time:${format.format(Calendar.getInstance().time)}"""
)
writer
.
newLine
()
writer
.
write
(
"ExpertUid = ${ModularServiceManager.getPlatformUserService()?.getUser()?.userId}"
)
writer
.
newLine
()
writer
.
write
(
"""Network:${RxNetTool.getNetWorkTypeName(BaseApp.getApp())}"""
)
writer
.
newLine
()
writer
.
write
(
"""DevicesInfo:${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()}"""
)
writer
.
newLine
()
writer
.
write
(
"""VersionInfo:${RxAppTool.getAppVersionName(BaseApp.getApp())}"""
)
writer
.
newLine
()
}
writer
.
write
(
content
)
writer
.
newLine
()
writer
.
flush
()
writer
.
close
()
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/log/LogHelper.kt
View file @
5b638bfd
...
...
@@ -154,6 +154,8 @@ class LogHelper private constructor() {
val
yunxinLog
=
getYunXinLog
(
BaseApp
.
getApp
())
//声网日志
val
agoraLog
=
getAgoraLog
(
BaseApp
.
getApp
())
val
agoraRtmLog
=
getAgoraRTMLog
(
BaseApp
.
getApp
())
val
agoraRtmBackLog
=
getAgoraRtmBackLog
(
BaseApp
.
getApp
())
if
(
zipFile
.
exists
())
zipFile
.
delete
()
zipFile
.
createNewFile
()
...
...
@@ -167,6 +169,12 @@ class LogHelper private constructor() {
if
(
agoraLog
.
exists
())
{
files
.
add
(
agoraLog
)
}
if
(
agoraRtmLog
.
exists
())
{
files
.
add
(
agoraRtmLog
)
}
if
(
agoraRtmBackLog
.
exists
())
{
files
.
add
(
agoraRtmBackLog
)
}
// ZipUtils.toZip(getLogFolder().absolutePath, FileOutputStream(zipFile), true)
ZipUtils
.
toZip
(
files
,
FileOutputStream
(
zipFile
))
...
...
@@ -233,6 +241,20 @@ class LogHelper private constructor() {
return
File
(
filePath
)
}
//获取RTM日志
private
fun
getAgoraRTMLog
(
context
:
Context
):
File
{
val
agoraRTMLog
=
FileUtils
.
getSDDirectory
()
+
"/"
+
context
.
packageName
+
"/agorartm.log"
return
File
(
agoraRTMLog
)
}
//获取RTM备份日志
private
fun
getAgoraRtmBackLog
(
context
:
Context
):
File
{
val
agoraRTMLog
=
FileUtils
.
getSDDirectory
()
+
"/"
+
context
.
packageName
+
"/agorartm_1.log"
return
File
(
agoraRTMLog
)
}
private
object
Holder
{
val
INSTANCE
=
LogHelper
()
}
...
...
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