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
7effc766
Commit
7effc766
authored
Mar 03, 2026
by
dsq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增日志打印
parent
edb1f9df
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
4 deletions
+81
-4
TestLog.android.kt
...rc/androidMain/kotlin/com.dong.demo013/TestLog.android.kt
+6
-0
App.kt
composeApp/src/commonMain/kotlin/com.dong.demo013/App.kt
+31
-2
TestLog.kt
composeApp/src/commonMain/kotlin/com.dong.demo013/TestLog.kt
+5
-1
TestLog.ios.kt
...oseApp/src/iosMain/kotlin/com.dong.demo013/TestLog.ios.kt
+6
-0
TestLog.ohosArm64.kt
...hosArm64Main/kotlin/com.dong.demo013/TestLog.ohosArm64.kt
+31
-1
libkn.so
harmonyApp/entry/libs/arm64-v8a/libkn.so
+0
-0
libkn_api.h
harmonyApp/entry/src/main/cpp/include/libkn_api.h
+2
-0
No files found.
composeApp/src/androidMain/kotlin/com.dong.demo013/TestLog.android.kt
View file @
7effc766
...
...
@@ -10,4 +10,10 @@ actual fun startLog(
onTimerUpdated
:
((
Long
)
->
Unit
)?
):
LogController
{
TODO
(
"Not yet implemented"
)
}
actual
fun
pirntAllLevelHiLog
()
{
}
actual
fun
pirntSingleHiLog
()
{
}
\ No newline at end of file
composeApp/src/commonMain/kotlin/com.dong.demo013/App.kt
View file @
7effc766
...
...
@@ -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
(
"进入
大量
日志测试"
)
}
}
...
...
composeApp/src/commonMain/kotlin/com.dong.demo013/TestLog.kt
View file @
7effc766
...
...
@@ -3,4 +3,8 @@ package com.dong.demo013
expect
fun
startLog
(
speed
:
Int
,
onLogGenerated
:
((
Int
)
->
Unit
)?
=
null
,
onTimerUpdated
:
((
Long
)
->
Unit
)?
=
null
):
LogController
// 创建独立的计时器控制器
expect
fun
createTimer
():
TimerController
\ No newline at end of file
expect
fun
createTimer
():
TimerController
expect
fun
pirntAllLevelHiLog
();
expect
fun
pirntSingleHiLog
();
\ No newline at end of file
composeApp/src/iosMain/kotlin/com.dong.demo013/TestLog.ios.kt
View file @
7effc766
...
...
@@ -10,4 +10,10 @@ actual fun startLog(
onTimerUpdated
:
((
Long
)
->
Unit
)?
):
LogController
{
TODO
(
"Not yet implemented"
)
}
actual
fun
pirntAllLevelHiLog
()
{
}
actual
fun
pirntSingleHiLog
()
{
}
\ No newline at end of file
composeApp/src/ohosArm64Main/kotlin/com.dong.demo013/TestLog.ohosArm64.kt
View file @
7effc766
...
...
@@ -88,4 +88,34 @@ fun hiLogPrintMsg(type: UInt, level: UInt, domain: UInt, tag: String, message: S
-
1
}
}
\ No newline at end of file
}
actual
fun
pirntSingleHiLog
(){
OH_LOG_PrintMsg
(
0
u
,
3
u
,
4660
u
,
"TestTag"
,
"单次日志打印"
);
}
actual
fun
pirntAllLevelHiLog
(){
// 输出 DEBUG 级别
// LOG_APP = 0 (应用日志类型)
// LOG_DEBUG = 3 (调试级别)
// domain = 0x1234 (任意自定义值,范围0x0000-0xFFFF)
// tag = "TestTag" (自定义标签)
OH_LOG_PrintMsg
(
0
u
,
3
u
,
4660
u
,
"TestTag"
,
"This is a DEBUG log from PrintMsg"
);
// 输出 INFO 级别
// LOG_INFO = 4 (信息级别)
OH_LOG_PrintMsg
(
0
u
,
4
u
,
4660
u
,
"TestTag"
,
"This is an INFO log from PrintMsg"
);
// 输出 WARN 级别
// LOG_WARN = 5 (警告级别)
OH_LOG_PrintMsg
(
0
u
,
5
u
,
4660
u
,
"TestTag"
,
"This is a WARN log from PrintMsg"
);
// 输出 ERROR 级别
// LOG_ERROR = 6 (错误级别)
OH_LOG_PrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"This is an ERROR log from PrintMsg"
);
// 输出 FATAL 级别
// LOG_FATAL = 7 (致命级别)
OH_LOG_PrintMsg
(
0
u
,
7
u
,
4660
u
,
"TestTag"
,
"This is a FATAL log from PrintMsg"
);
}
harmonyApp/entry/libs/arm64-v8a/libkn.so
View file @
7effc766
No preview for this file type
harmonyApp/entry/src/main/cpp/include/libkn_api.h
View file @
7effc766
...
...
@@ -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_______________
)();
...
...
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