pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
Macros | Typedefs | Functions | Variables
logging_internal.h File Reference
#include <glib.h>
#include <crm/common/logging.h>
#include <crm/common/output_internal.h>
Include dependency graph for logging_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PCMK__LOGGING_INTERNAL_H
 
#define pcmk__config_err(fmt...)
 
#define pcmk__config_warn(fmt...)
 
#define pcmk__if_tracing(if_action, else_action)
 
#define pcmk__log_xml_changes(level, xml)
 
#define pcmk__log_xml_patchset(level, patchset)
 

Typedefs

typedef void(* pcmk__config_error_func) (void *ctx, const char *msg,...)
 
typedef void(* pcmk__config_warning_func) (void *ctx, const char *msg,...)
 

Functions

void pcmk__set_config_error_handler (pcmk__config_error_func error_handler, void *error_context)
 
void pcmk__set_config_warning_handler (pcmk__config_warning_func warning_handler, void *warning_context)
 
void pcmk__log_xml_changes_as (const char *file, const char *function, uint32_t line, uint32_t tags, uint8_t level, const xmlNode *xml)
 
void pcmk__log_xml_patchset_as (const char *file, const char *function, uint32_t line, uint32_t tags, uint8_t level, const xmlNode *patchset)
 
void pcmk__cli_init_logging (const char *name, unsigned int verbosity)
 
int pcmk__add_logfile (const char *filename)
 Add a file to be used as a Pacemaker detail log. More...
 
void pcmk__add_logfiles (gchar **log_files, pcmk__output_t *out)
 Add multiple additional log files. More...
 
void pcmk__free_common_logger (void)
 

Variables

pcmk__config_error_func pcmk__config_error_handler
 
pcmk__config_warning_func pcmk__config_warning_handler
 
void * pcmk__config_error_context
 
void * pcmk__config_warning_context
 

Macro Definition Documentation

◆ pcmk__config_err

#define pcmk__config_err (   fmt...)
Value:
do { \
crm_config_error = TRUE; \
if (pcmk__config_error_handler == NULL) { \
crm_err(fmt); \
} else { \
pcmk__config_error_handler(pcmk__config_error_context, fmt); \
} \
} while (0)
void * pcmk__config_error_context
Definition: logging.c:56
pcmk__config_error_func pcmk__config_error_handler
Definition: logging.c:54

Definition at line 41 of file logging_internal.h.

◆ pcmk__config_warn

#define pcmk__config_warn (   fmt...)
Value:
do { \
crm_config_warning = TRUE; \
crm_warn(fmt); \
} else { \
pcmk__config_warning_handler(pcmk__config_warning_context, fmt); \
} \
} while (0)
pcmk__config_warning_func pcmk__config_warning_handler
Definition: logging.c:55
void * pcmk__config_warning_context
Definition: logging.c:57

Definition at line 57 of file logging_internal.h.

◆ pcmk__if_tracing

#define pcmk__if_tracing (   if_action,
  else_action 
)
Value:
do { \
static struct qb_log_callsite *trace_cs = NULL; \
\
if (trace_cs == NULL) { \
trace_cs = qb_log_callsite_get(__func__, __FILE__, \
"if_tracing", LOG_TRACE, \
__LINE__, crm_trace_nonlog); \
} \
if_action; \
} else { \
else_action; \
} \
} while (0)
#define LOG_TRACE
Definition: logging.h:38
unsigned int crm_trace_nonlog
Definition: logging.c:46
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
Definition: logging.c:680

Definition at line 79 of file logging_internal.h.

◆ pcmk__log_xml_changes

#define pcmk__log_xml_changes (   level,
  xml 
)
Value:
do { \
uint8_t _level = pcmk__clip_log_level(level); \
static struct qb_log_callsite *xml_cs = NULL; \
\
switch (_level) { \
case LOG_STDOUT: \
case LOG_NEVER: \
break; \
default: \
if (xml_cs == NULL) { \
xml_cs = qb_log_callsite_get(__func__, __FILE__, \
"xml-changes", _level, \
__LINE__, 0); \
} \
if (crm_is_callsite_active(xml_cs, _level, 0)) { \
pcmk__log_xml_changes_as(__FILE__, __func__, __LINE__, \
0, _level, xml); \
} \
break; \
} \
} while(0)
#define LOG_NEVER
Definition: logging.h:48
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
Definition: logging.c:680
#define LOG_STDOUT
Definition: logging.h:43

Definition at line 104 of file logging_internal.h.

◆ pcmk__log_xml_patchset

#define pcmk__log_xml_patchset (   level,
  patchset 
)
Value:
do { \
uint8_t _level = pcmk__clip_log_level(level); \
static struct qb_log_callsite *xml_cs = NULL; \
\
switch (_level) { \
case LOG_STDOUT: \
case LOG_NEVER: \
break; \
default: \
if (xml_cs == NULL) { \
xml_cs = qb_log_callsite_get(__func__, __FILE__, \
"xml-patchset", _level, \
__LINE__, 0); \
} \
if (crm_is_callsite_active(xml_cs, _level, 0)) { \
pcmk__log_xml_patchset_as(__FILE__, __func__, __LINE__, \
0, _level, patchset); \
} \
break; \
} \
} while(0)
#define LOG_NEVER
Definition: logging.h:48
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
Definition: logging.c:680
#define LOG_STDOUT
Definition: logging.h:43

Definition at line 135 of file logging_internal.h.

◆ PCMK__LOGGING_INTERNAL_H

#define PCMK__LOGGING_INTERNAL_H

Definition at line 15 of file logging_internal.h.

Typedef Documentation

◆ pcmk__config_error_func

typedef void(* pcmk__config_error_func) (void *ctx, const char *msg,...)

Definition at line 22 of file logging_internal.h.

◆ pcmk__config_warning_func

typedef void(* pcmk__config_warning_func) (void *ctx, const char *msg,...)

Definition at line 23 of file logging_internal.h.

Function Documentation

◆ pcmk__add_logfile()

int pcmk__add_logfile ( const char *  filename)

Add a file to be used as a Pacemaker detail log.

Parameters
[in]filenameName of log file to use
Returns
Standard Pacemaker return code

Definition at line 317 of file logging.c.

◆ pcmk__add_logfiles()

void pcmk__add_logfiles ( gchar **  log_files,
pcmk__output_t out 
)

Add multiple additional log files.

Parameters
[in]log_filesArray of log files to add
[in]outOutput object to use for error reporting
Returns
Standard Pacemaker return code

Definition at line 401 of file logging.c.

◆ pcmk__cli_init_logging()

void pcmk__cli_init_logging ( const char *  name,
unsigned int  verbosity 
)

Definition at line 1137 of file logging.c.

◆ pcmk__free_common_logger()

void pcmk__free_common_logger ( void  )

Definition at line 1253 of file logging.c.

◆ pcmk__log_xml_changes_as()

void pcmk__log_xml_changes_as ( const char *  file,
const char *  function,
uint32_t  line,
uint32_t  tags,
uint8_t  level,
const xmlNode *  xml 
)

Definition at line 1200 of file logging.c.

◆ pcmk__log_xml_patchset_as()

void pcmk__log_xml_patchset_as ( const char *  file,
const char *  function,
uint32_t  line,
uint32_t  tags,
uint8_t  level,
const xmlNode *  patchset 
)

Definition at line 1231 of file logging.c.

◆ pcmk__set_config_error_handler()

void pcmk__set_config_error_handler ( pcmk__config_error_func  error_handler,
void *  error_context 
)

Definition at line 1289 of file logging.c.

◆ pcmk__set_config_warning_handler()

void pcmk__set_config_warning_handler ( pcmk__config_warning_func  warning_handler,
void *  warning_context 
)

Definition at line 1295 of file logging.c.

Variable Documentation

◆ pcmk__config_error_context

void* pcmk__config_error_context

Definition at line 56 of file logging.c.

◆ pcmk__config_error_handler

pcmk__config_error_func pcmk__config_error_handler

Definition at line 54 of file logging.c.

◆ pcmk__config_warning_context

void* pcmk__config_warning_context

Definition at line 57 of file logging.c.

◆ pcmk__config_warning_handler

pcmk__config_warning_func pcmk__config_warning_handler

Definition at line 55 of file logging.c.