Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TestToolChainDemo
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
dsq
TestToolChainDemo
Commits
ca60f7f3
Commit
ca60f7f3
authored
Mar 14, 2026
by
dsq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改日志打印文本
parent
fdc2313b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
HighLogDemo.kt
...src/commonMain/kotlin/com.dong.demo013/Log/HighLogDemo.kt
+5
-3
TestLog.ohosArm64.kt
...hosArm64Main/kotlin/com.dong.demo013/TestLog.ohosArm64.kt
+2
-2
TestLog.ohosX64.kt
...rc/ohosX64Main/kotlin/com.dong/demo013/TestLog.ohosX64.kt
+2
-2
No files found.
composeApp/src/commonMain/kotlin/com.dong.demo013/Log/HighLogDemo.kt
View file @
ca60f7f3
...
@@ -8,6 +8,7 @@ import androidx.compose.ui.Alignment
...
@@ -8,6 +8,7 @@ import androidx.compose.ui.Alignment
import
androidx.compose.ui.Modifier
import
androidx.compose.ui.Modifier
import
androidx.compose.ui.text.input.KeyboardType
import
androidx.compose.ui.text.input.KeyboardType
import
androidx.compose.ui.unit.dp
import
androidx.compose.ui.unit.dp
import
com.dong.demo013.pirntRandomHiLog
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.isActive
import
kotlinx.coroutines.isActive
import
kotlin.time.TimeSource
import
kotlin.time.TimeSource
...
@@ -16,7 +17,7 @@ import kotlin.time.TimeSource
...
@@ -16,7 +17,7 @@ import kotlin.time.TimeSource
@Composable
@Composable
internal
fun
HighLogDemo
()
{
internal
fun
HighLogDemo
()
{
// 日志参数状态
// 日志参数状态
var
logSpeed
by
remember
{
mutableStateOf
(
"100"
)
}
var
logSpeed
by
remember
{
mutableStateOf
(
"100
0
"
)
}
var
logCount
by
remember
{
mutableStateOf
(
0
)
}
var
logCount
by
remember
{
mutableStateOf
(
0
)
}
var
isGenerating
by
remember
{
mutableStateOf
(
false
)
}
var
isGenerating
by
remember
{
mutableStateOf
(
false
)
}
...
@@ -31,7 +32,7 @@ internal fun HighLogDemo() {
...
@@ -31,7 +32,7 @@ internal fun HighLogDemo() {
if
(
isTimerRunning
)
{
if
(
isTimerRunning
)
{
startTimeMark
=
timeSource
.
markNow
()
startTimeMark
=
timeSource
.
markNow
()
while
(
isActive
&&
isTimerRunning
)
{
while
(
isActive
&&
isTimerRunning
)
{
delay
(
100
)
// 每 1
00ms 更新一次显示
delay
(
100
0
)
// 每 10
00ms 更新一次显示
displayTime
=
startTimeMark
.
elapsedNow
().
inWholeSeconds
displayTime
=
startTimeMark
.
elapsedNow
().
inWholeSeconds
}
}
}
else
{
}
else
{
...
@@ -43,10 +44,11 @@ internal fun HighLogDemo() {
...
@@ -43,10 +44,11 @@ internal fun HighLogDemo() {
// 日志生成协程
// 日志生成协程
LaunchedEffect
(
isGenerating
,
logSpeed
)
{
LaunchedEffect
(
isGenerating
,
logSpeed
)
{
if
(
isGenerating
)
{
if
(
isGenerating
)
{
val
speed
=
logSpeed
.
toIntOrNull
()
?:
100
val
speed
=
logSpeed
.
toIntOrNull
()
?:
100
0
while
(
isActive
&&
isGenerating
)
{
while
(
isActive
&&
isGenerating
)
{
delay
(
speed
.
toLong
())
delay
(
speed
.
toLong
())
logCount
++
logCount
++
pirntRandomHiLog
()
}
}
}
}
}
}
...
...
composeApp/src/ohosArm64Main/kotlin/com.dong.demo013/TestLog.ohosArm64.kt
View file @
ca60f7f3
...
@@ -14,7 +14,7 @@ fun hiLogPrintMsg(type: UInt, level: UInt, domain: UInt, tag: String, message: S
...
@@ -14,7 +14,7 @@ fun hiLogPrintMsg(type: UInt, level: UInt, domain: UInt, tag: String, message: S
}
}
actual
fun
pirntSingleHiLog
(){
actual
fun
pirntSingleHiLog
(){
hiLogPrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"单次日志打印"
);
hiLogPrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"单次日志打印
-高亮
"
);
}
}
...
@@ -45,5 +45,5 @@ actual fun pirntAllLevelHiLog(){
...
@@ -45,5 +45,5 @@ actual fun pirntAllLevelHiLog(){
actual
fun
pirntRandomHiLog
(){
actual
fun
pirntRandomHiLog
(){
hiLogPrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"
随机日志打印
"
);
hiLogPrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"
持续日志打印-高亮
"
);
}
}
composeApp/src/ohosX64Main/kotlin/com.dong/demo013/TestLog.ohosX64.kt
View file @
ca60f7f3
...
@@ -13,7 +13,7 @@ fun hiLogPrintMsg(type: UInt, level: UInt, domain: UInt, tag: String, message: S
...
@@ -13,7 +13,7 @@ fun hiLogPrintMsg(type: UInt, level: UInt, domain: UInt, tag: String, message: S
}
}
actual
fun
pirntSingleHiLog
(){
actual
fun
pirntSingleHiLog
(){
hiLogPrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"单次日志打印"
);
hiLogPrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"单次日志打印
-高亮
"
);
}
}
...
@@ -44,5 +44,5 @@ actual fun pirntAllLevelHiLog(){
...
@@ -44,5 +44,5 @@ actual fun pirntAllLevelHiLog(){
actual
fun
pirntRandomHiLog
(){
actual
fun
pirntRandomHiLog
(){
hiLogPrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"
随机日志打印
"
);
hiLogPrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"
持续日志打印-高亮
"
);
}
}
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