-
Notifications
You must be signed in to change notification settings - Fork 121
ohos: Use custom domain when logging with hilog #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
760ddba
to
cdb1229
Compare
@@ -47,7 +47,7 @@ index 3cfc92533..9c487ac45 100644 | |||
+#ifdef ANDROID | |||
+ __android_log_print(ANDROID_LOG_ERROR, "Gecko", "mozalloc_abort: %s", msg); | |||
+#elif defined(OHOS) | |||
+ (void) OH_LOG_Print(LOG_APP, LOG_ERROR, 0, "Gecko", | |||
+ (void) OH_LOG_Print(LOG_APP, LOG_ERROR, 0xEOC4, "Gecko", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to define a constant for this domain value, maybe in the init.configure, rather than hard coding it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is definitely better than copying the same value everywhere.
cdb1229
to
8af55cb
Compare
+def ohos_hilog_domain(target): | ||
+ return "0xE0C4" | ||
+ | ||
+set_define("OHOS_LOG_DOMAIN", ohos_hilog_domain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like set_define also accepts a when
argument. Is it not possible to use it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the implementation (set_define_impl) and the doc string says that when the value is false, the define will be explicitly undefined (-U).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, did you want to suggest to just remove the ohos_hilog_domain
function and instead use when? that makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, my idea was to see if we can just do set_define("OHOS_LOG_DOMAIN", "0xE0C4", when=target_is_ohos)
This modifies the existing patch to redirect log messages to hilog to use a non-zero domain, which allows us to filter logs via the domain on ohos devices. We set 0xE0C3 for Rust code in servo, using a different number allows us to seperate spidermonkey from servo logs if wanted. Signed-off-by: Jonathan Schwender <[email protected]>
8af55cb
to
882d13a
Compare
I'm not really sure what is going on here:
This causes
This does not define XP_OHOS. This seems really weird to me, and goes against the documentation of |
Signed-off-by: Jonathan Schwender <[email protected]>
c91b2b9
to
04b67af
Compare
This modifies the existing patch to redirect log messages to hilog to use a non-zero domain, which allows us to filter logs via the domain on ohos devices.
We set 0xE0C3 for Rust code in servo, using a different number allows us to seperate spidermonkey from servo logs if wanted.
This also uncovered and fixed two seperate issues with the patch:
XP_OHOS
define, sinceOHOS
is never defined by ustarget_is_ohos
check returning False still causesset_define
to set the define (differing from the documentation), so we need to return None.Fixes #582