Attention is currently required from: Timur Davydov, fixeria, laforge, neels, osmith.
pespin has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/libosmocore/+/41813?usp=email )
Change subject: Add Emscripten build support and JS callback logging backend ......................................................................
Patch Set 26:
(2 comments)
File src/core/logging_emscripten.c:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/05b17747_9b375ccc?u... : PS25, Line 47: char subsys_buf[16];
This is kept at 16 bytes for consistency with `logging_gsmtap.c` […]
That's due to "struct gsmtap_osmocore_log_hdr" being "char subsys[16]" because it's sent as fixed size over the wire. It may make sense to look at emscripten.h or on_log_wrapper() API doc to see if there's another limitation in your case.
In practice 16 is fine, just mentioning in case you want to look at it.
In any case, we tend to better use C style comments "/* */" in osmocom code.
File src/core/logging_emscripten.c:
https://gerrit.osmocom.org/c/libosmocore/+/41813/comment/ccc0bb60_bf465a68?u... : PS26, Line 45: const int msgLen = MAX_LOG_SIZE; Simply drop the variable and use MAX_LOG_SIZE directly, otherwise you are simply duplicating stuff and making code more complex for no good reason.
char msg[MAX_LOG_SIZE];
rc = vsnprintf(msg, sizeof(msg), format, ap); if (rc <= 0) return; if (rc >= sizeof(msg)) rc = sizeof(msg) - 1;
/* Drop newline at the end if exists: */ if (msg[rc - 1] == '\n') msg[rc - 1] = '\0';