Files
2026-07-09 07:40:42 +02:00

21 lines
1.2 KiB
C++

// titan_log.h - portable logging.
// On Android it routes to logcat (tag "Titan"); on a host build it goes to stderr, so the
// skeleton can be syntax/host-compiled without the NDK (see tools/scripts/verify_native_host.sh).
#pragma once
#if defined(__ANDROID__)
# include <android/log.h>
# define TITAN_LOGI(...) __android_log_print(ANDROID_LOG_INFO, "Titan", __VA_ARGS__)
# define TITAN_LOGW(...) __android_log_print(ANDROID_LOG_WARN, "Titan", __VA_ARGS__)
# define TITAN_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "Titan", __VA_ARGS__)
#else
# include <cstdio>
# define TITAN_LOGI(...) do { std::fprintf(stderr, "[Titan][I] "); std::fprintf(stderr, __VA_ARGS__); std::fprintf(stderr, "\n"); } while (0)
# define TITAN_LOGW(...) do { std::fprintf(stderr, "[Titan][W] "); std::fprintf(stderr, __VA_ARGS__); std::fprintf(stderr, "\n"); } while (0)
# define TITAN_LOGE(...) do { std::fprintf(stderr, "[Titan][E] "); std::fprintf(stderr, __VA_ARGS__); std::fprintf(stderr, "\n"); } while (0)
#endif
// Marks a reconstructed function whose behaviour is not yet recovered from the ARMv7 libg.so.
// Deliberately loud (once-per-call) so unreconstructed paths are obvious at runtime.
#define TITAN_TODO(name) TITAN_LOGW("TODO: %s not yet reconstructed (stub)", name)