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