2018-09-27 03:11:10 -04:00
|
|
|
#pragma once
|
2017-09-14 21:54:56 +08:00
|
|
|
|
2020-06-01 04:15:37 -07:00
|
|
|
#include <cerrno>
|
|
|
|
#include <cstdarg>
|
2018-09-27 03:11:10 -04:00
|
|
|
|
|
|
|
struct log_callback {
|
2022-07-01 04:53:41 -07:00
|
|
|
void (*d)(const char* fmt, va_list ap);
|
|
|
|
void (*i)(const char* fmt, va_list ap);
|
|
|
|
void (*w)(const char* fmt, va_list ap);
|
|
|
|
void (*e)(const char* fmt, va_list ap);
|
2018-09-27 03:11:10 -04:00
|
|
|
};
|
|
|
|
|
2020-06-01 04:15:37 -07:00
|
|
|
extern log_callback log_cb;
|
2018-09-27 03:11:10 -04:00
|
|
|
|
2021-08-12 03:26:54 -07: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);
|
2020-06-01 04:15:37 -07:00
|
|
|
#define PLOGE(fmt, args...) LOGE(fmt " failed with %d: %s\n", ##args, errno, std::strerror(errno))
|
2017-09-14 21:54:56 +08:00
|
|
|
|
2022-07-01 04:53:41 -07:00
|
|
|
void nop_log(const char *, va_list);
|
2017-09-14 21:54:56 +08:00
|
|
|
|
2018-09-27 03:11:10 -04:00
|
|
|
void cmdline_logging();
|
2022-07-01 04:53:41 -07:00
|
|
|
void exit_on_error(bool b);
|