shtr_log.h (2081B)
1 /* Copyright (C) 2022, 2025 |Méso|Star> (contact@meso-star.com) 2 * Copyright (C) 2025 Université de Lorraine 3 * Copyright (C) 2022 Centre National de la Recherche Scientifique 4 * Copyright (C) 2022 Université Paul Sabatier 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 19 #ifndef SHTR_LOG_H 20 #define SHTR_LOG_H 21 22 #include <rsys/rsys.h> 23 24 #define MSG_INFO_PREFIX "Star-HITRAN:\x1b[1m\x1b[32minfo\x1b[0m: " 25 #define MSG_ERROR_PREFIX "Star-HITRAN:\x1b[1m\x1b[31merror\x1b[0m: " 26 #define MSG_WARNING_PREFIX "Star-HITRAN:\x1b[1m\x1b[33mwarning\x1b[0m: " 27 28 struct shtr; 29 struct logger; 30 31 extern LOCAL_SYM res_T 32 setup_log_default 33 (struct shtr* shtr); 34 35 /* Conditionally log a message on the LOG_OUTPUT stream of the shtr logger, 36 * with respect to its verbose flag */ 37 extern LOCAL_SYM void 38 log_info 39 (const struct shtr* shtr, 40 const char* msg, 41 ...) 42 #ifdef COMPILER_GCC 43 __attribute((format(printf, 2, 3))) 44 #endif 45 ; 46 47 /* Conditionally log a message on the LOG_ERROR stream of the shtr logger, 48 * with respect to its verbose flag */ 49 extern LOCAL_SYM void 50 log_err 51 (const struct shtr* shtr, 52 const char* msg, 53 ...) 54 #ifdef COMPILER_GCC 55 __attribute((format(printf, 2, 3))) 56 #endif 57 ; 58 59 /* Conditionally log a message on the LOG_WARNING stream of the shtr logger, 60 * with respect to its verbose flag */ 61 extern LOCAL_SYM void 62 log_warn 63 (const struct shtr* shtr, 64 const char* msg, 65 ...) 66 #ifdef COMPILER_GCC 67 __attribute((format(printf, 2, 3))) 68 #endif 69 ; 70 71 72 #endif /* SHTR_LOG_H */ 73