Commit ca60f7f3 authored by dsq's avatar dsq

修改日志打印文本

parent fdc2313b
......@@ -8,6 +8,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import com.dong.demo013.pirntRandomHiLog
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlin.time.TimeSource
......@@ -16,7 +17,7 @@ import kotlin.time.TimeSource
@Composable
internal fun HighLogDemo() {
// 日志参数状态
var logSpeed by remember { mutableStateOf("100") }
var logSpeed by remember { mutableStateOf("1000") }
var logCount by remember { mutableStateOf(0) }
var isGenerating by remember { mutableStateOf(false) }
......@@ -31,7 +32,7 @@ internal fun HighLogDemo() {
if (isTimerRunning) {
startTimeMark = timeSource.markNow()
while (isActive && isTimerRunning) {
delay(100) // 每 100ms 更新一次显示
delay(1000) // 每 1000ms 更新一次显示
displayTime = startTimeMark.elapsedNow().inWholeSeconds
}
} else {
......@@ -43,10 +44,11 @@ internal fun HighLogDemo() {
// 日志生成协程
LaunchedEffect(isGenerating, logSpeed) {
if (isGenerating) {
val speed = logSpeed.toIntOrNull() ?: 100
val speed = logSpeed.toIntOrNull() ?: 1000
while (isActive && isGenerating) {
delay(speed.toLong())
logCount++
pirntRandomHiLog()
}
}
}
......
......@@ -14,7 +14,7 @@ fun hiLogPrintMsg(type: UInt, level: UInt, domain: UInt, tag: String, message: S
}
actual fun pirntSingleHiLog(){
hiLogPrintMsg(0u, 6u, 4660u, "TestTag", "单次日志打印");
hiLogPrintMsg(0u, 6u, 4660u, "TestTag", "单次日志打印-高亮");
}
......@@ -45,5 +45,5 @@ actual fun pirntAllLevelHiLog(){
actual fun pirntRandomHiLog(){
hiLogPrintMsg(0u, 6u, 4660u, "TestTag", "随机日志打印");
hiLogPrintMsg(0u, 6u, 4660u, "TestTag", "持续日志打印-高亮");
}
......@@ -13,7 +13,7 @@ fun hiLogPrintMsg(type: UInt, level: UInt, domain: UInt, tag: String, message: S
}
actual fun pirntSingleHiLog(){
hiLogPrintMsg(0u, 6u, 4660u, "TestTag", "单次日志打印");
hiLogPrintMsg(0u, 6u, 4660u, "TestTag", "单次日志打印-高亮");
}
......@@ -44,5 +44,5 @@ actual fun pirntAllLevelHiLog(){
actual fun pirntRandomHiLog(){
hiLogPrintMsg(0u, 6u, 4660u, "TestTag", "随机日志打印");
hiLogPrintMsg(0u, 6u, 4660u, "TestTag", "持续日志打印-高亮");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment