18 lines
463 B
C++
18 lines
463 B
C++
#include "logger.h"
|
|
|
|
#if defined(__ANDROID__)
|
|
static void (*androidLog)(const char*) = nullptr;
|
|
|
|
void UseAndroidLog(void (*cb)(const char*)) {
|
|
androidLog = cb;
|
|
}
|
|
|
|
__attribute__((format(printf, 1, 2)))
|
|
void android_log(const char* fmt, ...) {
|
|
char buf[256];
|
|
va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap);
|
|
__android_log_print(ANDROID_LOG_DEBUG, "YAMA_NET", "%s", buf);
|
|
if (androidLog) androidLog(buf);
|
|
}
|
|
#endif
|