ohos: Use custom domain when logging with hilog#583
ohos: Use custom domain when logging with hilog#583jschwe wants to merge 2 commits intoservo:mainfrom
Conversation
760ddba to
cdb1229
Compare
| + __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.
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.
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.
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.
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.
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.
Right, my idea was to see if we can just do set_define("OHOS_LOG_DOMAIN", "0xE0C4", when=target_is_ohos)
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 |
c91b2b9 to
04b67af
Compare
|
@jschwe is this PR still relevant? |
|
IMHO yes. I didn't proceed, because it seems I don't understand |
I think the documentation of The existing defines for XP_DARWIN, XP_WINDOW don't have a False return and instead let the predicate methods just return |
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 <schwenderjonathan@gmail.com> # Conflicts: # mozjs-sys/etc/patches/0036-Redirect_errors_to_hilog_on_OpenHarmony.patch # mozjs-sys/mozjs/memory/mozalloc/mozalloc_abort.cpp # mozjs-sys/mozjs/mozglue/misc/Debug.cpp # mozjs-sys/mozjs/nsprpub/pr/src/io/prlog.c
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
04b67af to
753128f
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_OHOSdefine, sinceOHOSis never defined by ustarget_is_ohoscheck returning False still causesset_defineto set the define (differing from the documentation), so we need to return None.Fixes #582