Open leleliu008 opened 1 year ago
https://man7.org/linux/man-pages/man3/syslog.3.html would be the portable way to log from libc (and ends up in the same place).
The only downsides to syslog is that iirc you can only have one log tag per process, and that it'll only work (i.e. end up in logcat) for... M+? It's been a long time, but I think in the absolute oldest devices we support it won't work.
For the use case of static executables those don't actually sound like a problem. There may not be any point in providing liblog.a.
Android L
reimplement the loging system, the new implemention doesn't adapt to the old android devices, that's why they do not provide liblog.a
It seems that I have to implement it by myself.
I find golang implement it's android log system client.
if you're worried about pre-L like that golang code, note that the next release of the NDK won't support pre-L anyway...
The only downsides to syslog is that iirc you can only have one log tag per process
(for the record, that's not strictly correct --- syslog() will use whatever tag the latest openlog() used. but of course if you have multiple threads trying to use multiple tags, you'll need to add some synchronization there, which may or may not be worth it.)
Description
some command-line tools can not be built as fully statically linked executable due to lack of
liblog.a
.as a workaround, can I build it from AOSP?