Skip to content

Log errors to hilog on OpenHarmony#488

Merged
sagudev merged 3 commits intoservo:mainfrom
jschwe:jschwender/ohos_prints
Aug 6, 2024
Merged

Log errors to hilog on OpenHarmony#488
sagudev merged 3 commits intoservo:mainfrom
jschwe:jschwender/ohos_prints

Conversation

@jschwe
Copy link
Member

@jschwe jschwe commented Jul 31, 2024

Similar to android, stderr output is generally not visible on OpenHarmony devices. Error messages should instead be logged via the hilog logging service.
During normal operations, we can also do a workaround where we redirect stderr to hilog via a dedicated logging thread.
However, for fatal errors such as failed assertions, which lead to the whole process dying, this solution is not sufficient, since the process might die before the logging thread has a chance to print the error message it received on stderr.

@jschwe jschwe force-pushed the jschwender/ohos_prints branch from 3a539ba to ca6d709 Compare July 31, 2024 11:29
@sagudev
Copy link
Member

sagudev commented Jul 31, 2024

About symbol visibility you should read servo/servo#32769 (comment), so I think you only need to do something like:

system_headers += [
    'hilog/log.h',
]

also this is something that is not really servo specific, so you should try to upstream it.

@jschwe
Copy link
Member Author

jschwe commented Jul 31, 2024

so I think you only need to do something like:

Thanks! That looks exactly like what I want.

also this is something that is not really servo specific, so you should try to upstream it.

That is my plan. But I want to get it working with servo first, and then tackle rebasing to latest upstream (and hope upstream is interested).

@jschwe jschwe force-pushed the jschwender/ohos_prints branch from ca6d709 to 72ee408 Compare July 31, 2024 13:41
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
@jschwe jschwe force-pushed the jschwender/ohos_prints branch from 72ee408 to 820da15 Compare August 6, 2024 12:21
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
@jschwe jschwe force-pushed the jschwender/ohos_prints branch from 35c2586 to f170b1c Compare August 6, 2024 13:07
@jschwe jschwe marked this pull request as ready for review August 6, 2024 13:08
@jschwe jschwe changed the title Draft: Add hilog sink for OpenHarmony Log errors to hilog on OpenHarmony Aug 6, 2024
@sagudev
Copy link
Member

sagudev commented Aug 6, 2024

All PRs that change mozjs-sys/mozjs or other cpp code need to bump mozjs-sys version.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
@jschwe jschwe force-pushed the jschwender/ohos_prints branch from f51178f to 5ebf888 Compare August 6, 2024 15:53
@jschwe jschwe mentioned this pull request Aug 6, 2024
3 tasks
@sagudev sagudev added this pull request to the merge queue Aug 6, 2024
Merged via the queue into servo:main with commit c715ae4 Aug 6, 2024
@jschwe jschwe deleted the jschwender/ohos_prints branch August 6, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants