Magisk/native/jni/utils/logging.hpp

27 lines
711 B
C++
Raw Normal View History

2018-09-27 07:11:10 +00:00
#pragma once
2017-09-14 13:54:56 +00:00
#include <cerrno>
#include <cstdarg>
2018-09-27 07:11:10 +00:00
struct log_callback {
int (*d)(const char* fmt, va_list ap);
int (*i)(const char* fmt, va_list ap);
int (*w)(const char* fmt, va_list ap);
int (*e)(const char* fmt, va_list ap);
void (*ex)(int code);
2018-09-27 07:11:10 +00:00
};
extern log_callback log_cb;
2018-09-27 07:11:10 +00:00
2021-08-12 10:26:54 +00:00
void LOGD(const char *fmt, ...) __printflike(1, 2);
void LOGI(const char *fmt, ...) __printflike(1, 2);
void LOGW(const char *fmt, ...) __printflike(1, 2);
void LOGE(const char *fmt, ...) __printflike(1, 2);
#define PLOGE(fmt, args...) LOGE(fmt " failed with %d: %s\n", ##args, errno, std::strerror(errno))
2017-09-14 13:54:56 +00:00
int nop_log(const char *, va_list);
void nop_ex(int);
2017-09-14 13:54:56 +00:00
2018-09-27 07:11:10 +00:00
void no_logging();
void cmdline_logging();