mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-19 08:03:09 +00:00
Revise logging code
This commit is contained in:
@@ -2,14 +2,6 @@
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
|
||||
enum {
|
||||
L_DEBUG,
|
||||
L_INFO,
|
||||
L_WARN,
|
||||
L_ERR
|
||||
};
|
||||
|
||||
struct log_callback {
|
||||
int (*d)(const char* fmt, va_list ap);
|
||||
@@ -21,10 +13,10 @@ struct log_callback {
|
||||
|
||||
extern log_callback log_cb;
|
||||
|
||||
#define LOGD(...) log_handler<L_DEBUG>(__VA_ARGS__)
|
||||
#define LOGI(...) log_handler<L_INFO>(__VA_ARGS__)
|
||||
#define LOGW(...) log_handler<L_WARN>(__VA_ARGS__)
|
||||
#define LOGE(...) log_handler<L_ERR>(__VA_ARGS__)
|
||||
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))
|
||||
|
||||
int nop_log(const char *, va_list);
|
||||
@@ -32,6 +24,3 @@ void nop_ex(int);
|
||||
|
||||
void no_logging();
|
||||
void cmdline_logging();
|
||||
|
||||
template<int type>
|
||||
void log_handler(const char *fmt, ...) __printflike(1, 2);
|
||||
|
Reference in New Issue
Block a user