stardis-solver

Solve coupled heat transfers
git clone git://git.meso-star.fr/stardis-solver.git
Log | Files | Refs | README | LICENSE

sdis_log.h (2253B)


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