--- lbbs/include/log.h 2025/06/04 13:42:53 1.6 +++ lbbs/include/log.h 2025/06/21 02:15:18 1.8 @@ -17,20 +17,22 @@ #ifndef _LOG_H_ #define _LOG_H_ -#include +#include -extern int log_begin(char *common_log_file, char *error_log_file); +enum{ + LOG_LEVEL_COMMON = 1, + LOG_LEVEL_ERROR = 2, +}; +extern int log_begin(char *common_log_file, char *error_log_file); extern void log_end(); -extern int log_head(char *buf, size_t len); +extern int log_printf(int log_level, const char *app_file, int app_line, const char *format, ...); -extern int log_common(const char *format, ...); - -extern int log_error(const char *format, ...); +#define log_common(...) log_printf(LOG_LEVEL_COMMON, __FILE__, __LINE__, __VA_ARGS__) +#define log_error(...) log_printf(LOG_LEVEL_ERROR, __FILE__, __LINE__, __VA_ARGS__) extern int log_common_redir(int fd); - extern int log_error_redir(int fd); #endif //_LOG_H_