--- lbbs/include/log.h 2025/05/04 14:54:55 1.2 +++ lbbs/include/log.h 2025/11/04 13:49:50 1.9 @@ -1,35 +1,31 @@ -/*************************************************************************** - log.h - description - ------------------- - begin : Wed Mar 16 2004 - copyright : (C) 2005 by Leaflet - email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * log + * - logger + * + * Copyright (C) 2004-2025 by Leaflet + */ #ifndef _LOG_H_ #define _LOG_H_ -extern int log_begin(char *file_log_std, char *file_log_err); +#include -extern void log_end(); - -extern int log_head(char *buf); +enum +{ + LOG_LEVEL_COMMON = 1, + LOG_LEVEL_ERROR = 2, +}; -extern int log_std(const char *format, ...); +extern int log_begin(char *common_log_file, char *error_log_file); +extern void log_end(); -extern int log_error(const char *format, ...); +extern int log_printf(int log_level, const char *app_file, int app_line, const char *format, ...); -extern int log_std_redirect(int fd); +#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_err_redirect(int fd); +extern int log_common_redir(int fd); +extern int log_error_redir(int fd); #endif //_LOG_H_