No more requires logging.hpp for exported headers

This commit is contained in:
LoveSy 2022-02-19 03:59:06 +08:00
parent 5bab7a0e38
commit 87af5e7985
2 changed files with 16 additions and 6 deletions

View File

@ -2,9 +2,7 @@
#include <concepts>
#include "hook_helper.hpp"
#include "jni_helper.hpp"
#include "logging.hpp"
#define CONCATENATE(a, b) a##b
@ -181,7 +179,14 @@ inline static bool HookSym(const HookHandler &handler, T &arg) {
template <HookerType T, HookerType... Args>
inline static bool HookSyms(const HookHandler &handle, T &first, Args &...rest) {
if (!(HookSym(handle, first) || ... || HookSym(handle, rest))) {
LOGW("Hook Fails: %*s", static_cast<int>(first.sym.size()), first.sym.data());
__android_log_print(ANDROID_LOG_ERROR,
#ifdef LOG_TAG
LOG_TAG,
#else
"HookHelper",
#endif
"Hook Fails: %*s", static_cast<int>(first.sym.size()),
first.sym.data());
return false;
}
return true;

View File

@ -6,8 +6,7 @@
#include <jni.h>
#include <string>
#include "logging.hpp"
#include <string_view>
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName &) = delete; \
@ -214,7 +213,13 @@ requires(std::is_function_v<Func>)
~finally() {
if (auto exception = ClearException(env_)) {
LOGE("%s", JUTFString(env_, exception.get()).get());
__android_log_print(ANDROID_LOG_ERROR,
#ifdef LOG_TAG
LOG_TAG,
#else
"JNIHelper",
#endif
"%s", JUTFString(env_, exception.get()).get());
}
}