Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ce18be0d
authored
Sep 30, 2025
by
cen
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: logcaht
1 parent
574c03a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
utils/logger/LogCat.js
utils/logger/LogCat.js
View file @
ce18be0
import
{
getTime
}
from
'./util'
import
{
serializeIfObject
}
from
'../utils'
class
LogCat
{
//
main = plus.android.runtimeMainActivity()
//
File = plus.android.importClass('java.io.File')
//
Environment = plus.android.importClass('android.os.Environment')
//
BufferedWriter = plus.android.importClass('java.io.BufferedWriter')
//
FileOutputStream = plus.android.importClass('java.io.FileOutputStream')
//
OutputStreamWriter = plus.android.importClass('java.io.OutputStreamWriter')
//
//
BufferedReader = plus.android.importClass('java.io.BufferedReader')
main
=
plus
.
android
.
runtimeMainActivity
()
File
=
plus
.
android
.
importClass
(
'java.io.File'
)
Environment
=
plus
.
android
.
importClass
(
'android.os.Environment'
)
BufferedWriter
=
plus
.
android
.
importClass
(
'java.io.BufferedWriter'
)
FileOutputStream
=
plus
.
android
.
importClass
(
'java.io.FileOutputStream'
)
OutputStreamWriter
=
plus
.
android
.
importClass
(
'java.io.OutputStreamWriter'
)
// BufferedReader = plus.android.importClass('java.io.BufferedReader')
// FileInputStream = plus.android.importClass('java.io.FileInputStream')
// InputStreamReader = plus.android.importClass('java.io.InputStreamReader')
LogPath
=
''
constructor
(
folderName
=
'_zyzs_log'
)
{
//
if (this.Environment.MEDIA_MOUNTED || !this.Environment.isExternalStorageRemovable()) {
//
this.LogPath = this.main.getExternalFilesDir(null).getPath() + folderName
//
} else {
//
this.LogPath = this.main.getFilesDir().getPath() + folderName
//
}
if
(
this
.
Environment
.
MEDIA_MOUNTED
||
!
this
.
Environment
.
isExternalStorageRemovable
())
{
this
.
LogPath
=
this
.
main
.
getExternalFilesDir
(
null
).
getPath
()
+
folderName
}
else
{
this
.
LogPath
=
this
.
main
.
getFilesDir
().
getPath
()
+
folderName
}
console
.
log
(
'日志文件存放路径->'
,
this
.
LogPath
)
}
writeLog
(
tag
,
messages
)
{
...
...
@@ -28,10 +28,10 @@ class LogCat {
//写入的内容
let
content
=
`
${
datetime
}
[
${
tag
}
] :
${
msg
}
\n`
console
.
log
(
content
.
replace
(
/
\n
/g
,
''
))
//
let path = new this.File(this.LogPath)
//
if (!path.exists()) {
//
path.mkdirs() //创建父路径
//
}
let
path
=
new
this
.
File
(
this
.
LogPath
)
if
(
!
path
.
exists
())
{
path
.
mkdirs
()
//创建父路径
}
let
fos
=
null
let
bw
=
null
try
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment