Ensure that logger function is always set
I700cbfbbfc45e3ae58606fc0c2a77f592f7d652a introduced a change that the
static variable `logger_function` is initialized at runtime (via the
static initializer) rather than at compile time. This actually was
unsafe because the static variable can be used "before" it is
initialized. For example, b/248162391 shows that it was used in the
context of the dynamic linker. The similar situation can happen if the
static variable is called from another static initializer (as C++
doesn't guarantee the order of static initializers).
This change fixes the issue by ensuring that `logger_function` (and
another static variable `file_logger`) is set before it is used.
Test: Do the mixed build test as described in b/248162391#comment2
1 file changed