1 /* 2 * Copyright 2004-2022 the Pacemaker project contributors 3 * 4 * The version control history for this file may have further details. 5 * 6 * This source code is licensed under the GNU General Public License version 2 7 * or later (GPLv2+) WITHOUT ANY WARRANTY. 8 */ 9 10 #ifndef PCMK__CRM_COMMON_LOGGING_COMPAT__H 11 # define PCMK__CRM_COMMON_LOGGING_COMPAT__H 12 13 #include <glib.h> 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /** 20 * \file 21 * \brief Deprecated Pacemaker logging API 22 * \ingroup core 23 * \deprecated Do not include this header directly. Do not use Pacemaker 24 * libraries for general-purpose logging; libqb's logging API is a 25 * suitable replacement. The logging APIs in this header, and the 26 * header itself, will be removed in a future release. 27 */ 28 29 /*! 30 * \brief Log a message using constant priority 31 * 32 * \param[in] level Priority at which to log the message 33 * \param[in] fmt printf-style format string literal for message 34 * \param[in] args Any arguments needed by format string 35 * 36 * \deprecated Do not use Pacemaker for general-purpose logging 37 * \note This is a macro, and \p level may be evaluated more than once. 38 * This does nothing when level is LOG_STDOUT. 39 */ 40 # define do_crm_log_always(level, fmt, args...) do { \ 41 switch (level) { \ 42 case LOG_STDOUT: case LOG_NEVER: \ 43 break; \ 44 default: \ 45 qb_log((level), fmt , ##args); \ 46 break; \ 47 } \ 48 } while (0) 49 50 //! \deprecated Do not use Pacemaker for general-purpose string handling 51 #define crm_str(x) (const char *) ((x)? (x) : "<null>") 52 53 //! \deprecated Do not use Pacemaker for general-purpose logging 54 gboolean crm_log_cli_init(const char *entity); 55 56 //! \deprecated Do not use Pacemaker for general-purpose logging 57 gboolean crm_add_logfile(const char *filename); 58 59 #ifdef __cplusplus 60 } 61 #endif 62 63 #endif // PCMK__CRM_COMMON_LOGGING_COMPAT__H