Sure, but you only have to put this code in the initialization of your lib, not all over the place.
If you use a NativeActivity, you don't even have to touch the lib. The code is meant to be executed once for the process.
But yeah, if you don't want any log.h anywhere, then I guess Andrew's solution is the way to go.