|
1 | | -#pragma once |
2 | | - |
3 | | -#define LOG_ERROR(fmt, ...) \ |
4 | | - { printf("ERROR - "), printf(fmt, ##__VA_ARGS__); } |
5 | | -#define LOG_WARN(fmt, ...) \ |
6 | | - { printf("WARNING - "), printf(fmt, ##__VA_ARGS__); } |
7 | | -#ifdef _DEBUG |
8 | | -# define LOG_INFO(fmt, ...) \ |
9 | | - { printf("INFO - "), printf(fmt, ##__VA_ARGS__); } |
10 | | -# define LOG_DEBUG(fmt, ...) \ |
11 | | - { printf("DEBUG - "), printf(fmt, ##__VA_ARGS__); } |
12 | | -#else |
13 | | -# define LOG_INFO(fmt, ...) |
14 | | -# define LOG_DEBUG(fmt, ...) |
15 | | -#endif |
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include <stdarg.h> |
| 4 | +#include <stdio.h> |
| 5 | + |
| 6 | +void proxy_log_set_error_cb(void (*func)(const char *fmt, va_list args)); |
| 7 | +void proxy_log_set_warn_cb(void (*func)(const char *fmt, va_list args)); |
| 8 | +void proxy_log_set_info_cb(void (*func)(const char *fmt, va_list args)); |
| 9 | +void proxy_log_set_debug_cb(void (*func)(const char *fmt, va_list args)); |
| 10 | + |
| 11 | +#ifdef __cplusplus |
| 12 | +extern "C" { |
| 13 | +#endif |
| 14 | + |
| 15 | +void log_error(const char *fmt, ...); |
| 16 | +void log_warn(const char *fmt, ...); |
| 17 | +void log_info(const char *fmt, ...); |
| 18 | +void log_debug(const char *fmt, ...); |
| 19 | + |
| 20 | +#ifdef __cplusplus |
| 21 | +} |
| 22 | +#endif |
| 23 | + |
| 24 | +#define LOG_ERROR log_error |
| 25 | +#define LOG_WARN log_warn |
| 26 | +#define LOG_INFO log_info |
| 27 | +#define LOG_DEBUG log_debug |
0 commit comments