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