Commit 7effc766 authored by dsq's avatar dsq

新增日志打印

parent edb1f9df
......@@ -11,3 +11,9 @@ actual fun startLog(
): LogController {
TODO("Not yet implemented")
}
actual fun pirntAllLevelHiLog() {
}
actual fun pirntSingleHiLog() {
}
\ No newline at end of file
......@@ -90,8 +90,37 @@ internal fun HomeScreen(
style = MaterialTheme.typography.h6,
modifier = Modifier.padding(bottom = 12.dp)
)
// 日志测试按钮区域
Column(
modifier = Modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Button(
onClick = {
pirntSingleHiLog();
},
modifier = Modifier.fillMaxWidth()
) {
Text("单次日志测试")
}
}
Column(
modifier = Modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Button(
onClick = {
pirntAllLevelHiLog();
},
modifier = Modifier.fillMaxWidth()
) {
Text("一次打印全部层级日志")
}
}
Column(
modifier = Modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(8.dp)
......@@ -107,7 +136,7 @@ internal fun HomeScreen(
},
modifier = Modifier.fillMaxWidth()
) {
Text("进入日志测试")
Text("进入大量日志测试")
}
}
......
......@@ -4,3 +4,7 @@ expect fun startLog(speed: Int, onLogGenerated: ((Int) -> Unit)? = null, onTimer
// 创建独立的计时器控制器
expect fun createTimer(): TimerController
expect fun pirntAllLevelHiLog();
expect fun pirntSingleHiLog();
\ No newline at end of file
......@@ -11,3 +11,9 @@ actual fun startLog(
): LogController {
TODO("Not yet implemented")
}
actual fun pirntAllLevelHiLog() {
}
actual fun pirntSingleHiLog() {
}
\ No newline at end of file
......@@ -89,3 +89,33 @@ fun hiLogPrintMsg(type: UInt, level: UInt, domain: UInt, tag: String, message: S
}
}
actual fun pirntSingleHiLog(){
OH_LOG_PrintMsg(0u, 3u, 4660u, "TestTag", "单次日志打印");
}
actual fun pirntAllLevelHiLog(){
// 输出 DEBUG 级别
// LOG_APP = 0 (应用日志类型)
// LOG_DEBUG = 3 (调试级别)
// domain = 0x1234 (任意自定义值,范围0x0000-0xFFFF)
// tag = "TestTag" (自定义标签)
OH_LOG_PrintMsg(0u, 3u, 4660u, "TestTag", "This is a DEBUG log from PrintMsg");
// 输出 INFO 级别
// LOG_INFO = 4 (信息级别)
OH_LOG_PrintMsg(0u, 4u, 4660u, "TestTag", "This is an INFO log from PrintMsg");
// 输出 WARN 级别
// LOG_WARN = 5 (警告级别)
OH_LOG_PrintMsg(0u, 5u, 4660u, "TestTag", "This is a WARN log from PrintMsg");
// 输出 ERROR 级别
// LOG_ERROR = 6 (错误级别)
OH_LOG_PrintMsg(0u, 6u, 4660u, "TestTag", "This is an ERROR log from PrintMsg");
// 输出 FATAL 级别
// LOG_FATAL = 7 (致命级别)
OH_LOG_PrintMsg(0u, 7u, 4660u, "TestTag", "This is a FATAL log from PrintMsg");
}
......@@ -374,6 +374,8 @@ typedef struct {
libkn_KInt (*com_dong_demo013_TimerControllerImpl$stableprop_getter______________)();
libkn_kref_com_dong_demo013_TimerController (*createTimer)();
libkn_KInt (*hiLogPrintMsg_)(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, const char* message);
void (*pirntAllLevelHiLog)();
void (*pirntSingleHiLog)();
libkn_kref_com_dong_demo013_LogController (*startLog)(libkn_KInt speed, libkn_kref_kotlin_Function1 onLogGenerated, libkn_kref_kotlin_Function1 onTimerUpdated);
libkn_KInt (*com_dong_demo013_Greeting$stableprop_getter_______________)();
libkn_KInt (*com_dong_demo013_LogControllerImpl$stableprop_getter_______________)();
......
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