pacemaker  2.1.5-b7adf64e51
Scalable High-Availability cluster resource manager
Macros | Typedefs | Functions | Variables
logging.c File Reference
#include <crm_internal.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <ctype.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <libgen.h>
#include <signal.h>
#include <bzlib.h>
#include <qb/qbdefs.h>
#include <crm/crm.h>
#include <crm/common/mainloop.h>
#include <crm/common/logging_compat.h>
Include dependency graph for logging.c:

Go to the source code of this file.

Macros

#define TIMESTAMP_FORMAT_SPEC   "%%t"
 
#define NAME_MAX   256
 
#define FMT_MAX   256
 
#define DEFAULT_LOG_FILE   CRM_LOG_DIR "/pacemaker.log"
 

Typedefs

typedef time_t log_time_t
 

Functions

void crm_log_deinit (void)
 
int pcmk__add_logfile (const char *filename)
 Add a file to be used as a Pacemaker detail log. More...
 
void crm_enable_blackbox (int nsig)
 
void crm_disable_blackbox (int nsig)
 
void crm_write_blackbox (int nsig, const struct qb_log_callsite *cs)
 
gboolean crm_is_callsite_active (struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
 
void crm_update_callsites (void)
 
void crm_log_preinit (const char *entity, int argc, char *const *argv)
 Initializes the logging system and defaults to the least verbose output level. More...
 
gboolean crm_log_init (const char *entity, uint8_t level, gboolean daemon, gboolean to_stderr, int argc, char **argv, gboolean quiet)
 
unsigned int set_crm_log_level (unsigned int level)
 
void crm_enable_stderr (int enable)
 
void crm_bump_log_level (int argc, char **argv)
 Make logging more verbose. More...
 
unsigned int get_crm_log_level (void)
 
void crm_log_args (int argc, char **argv)
 Log the command line (once) More...
 
void crm_log_output_fn (const char *file, const char *function, int line, int level, const char *prefix, const char *output)
 
void pcmk__cli_init_logging (const char *name, unsigned int verbosity)
 
gboolean crm_log_cli_init (const char *entity)
 
gboolean crm_add_logfile (const char *filename)
 

Variables

unsigned int crm_log_level = LOG_INFO
 
unsigned int crm_trace_nonlog = 0
 
bool pcmk__is_daemon = false
 

Macro Definition Documentation

◆ DEFAULT_LOG_FILE

#define DEFAULT_LOG_FILE   CRM_LOG_DIR "/pacemaker.log"

Definition at line 184 of file logging.c.

◆ FMT_MAX

#define FMT_MAX   256

Definition at line 132 of file logging.c.

◆ NAME_MAX

#define NAME_MAX   256

Definition at line 103 of file logging.c.

◆ TIMESTAMP_FORMAT_SPEC

#define TIMESTAMP_FORMAT_SPEC   "%%t"

Definition at line 41 of file logging.c.

Typedef Documentation

◆ log_time_t

typedef time_t log_time_t

Definition at line 42 of file logging.c.

Function Documentation

◆ crm_add_logfile()

gboolean crm_add_logfile ( const char *  filename)
Deprecated:
Do not use Pacemaker for general-purpose logging

Definition at line 1114 of file logging.c.

◆ crm_bump_log_level()

void crm_bump_log_level ( int  argc,
char **  argv 
)

Make logging more verbose.

If logging to stderr is not already enabled when this function is called, enable it. Otherwise, increase the log level by 1.

Parameters
[in]argcIgnored
[in]argvIgnored

Definition at line 1019 of file logging.c.

◆ crm_disable_blackbox()

void crm_disable_blackbox ( int  nsig)

Definition at line 458 of file logging.c.

◆ crm_enable_blackbox()

void crm_enable_blackbox ( int  nsig)

Definition at line 452 of file logging.c.

◆ crm_enable_stderr()

void crm_enable_stderr ( int  enable)

Definition at line 998 of file logging.c.

◆ crm_is_callsite_active()

gboolean crm_is_callsite_active ( struct qb_log_callsite *  cs,
uint8_t  level,
uint32_t  tags 
)

Definition at line 635 of file logging.c.

◆ crm_log_args()

void crm_log_args ( int  argc,
char **  argv 
)

Log the command line (once)

Parameters
[in]Numberof values in argv
[in]Command-linearguments (including command name)
Note
This function will only log once, even if called with different arguments.

Definition at line 1045 of file logging.c.

◆ crm_log_cli_init()

gboolean crm_log_cli_init ( const char *  entity)
Deprecated:
Do not use Pacemaker for general-purpose logging

Definition at line 1107 of file logging.c.

◆ crm_log_deinit()

void crm_log_deinit ( void  )

Definition at line 125 of file logging.c.

◆ crm_log_init()

gboolean crm_log_init ( const char *  entity,
uint8_t  level,
gboolean  daemon,
gboolean  to_stderr,
int  argc,
char **  argv,
gboolean  quiet 
)

Definition at line 850 of file logging.c.

◆ crm_log_output_fn()

void crm_log_output_fn ( const char *  file,
const char *  function,
int  line,
int  level,
const char *  prefix,
const char *  output 
)

Definition at line 1060 of file logging.c.

◆ crm_log_preinit()

void crm_log_preinit ( const char *  entity,
int  argc,
char *const *  argv 
)

Initializes the logging system and defaults to the least verbose output level.

Parameters
[in]entityIf not NULL, will be used as the identity for logging purposes
[in]argcThe number of command line parameters
[in]argvThe command line parameter values

Definition at line 765 of file logging.c.

◆ crm_update_callsites()

void crm_update_callsites ( void  )

Definition at line 664 of file logging.c.

◆ crm_write_blackbox()

void crm_write_blackbox ( int  nsig,
const struct qb_log_callsite *  cs 
)

Definition at line 474 of file logging.c.

◆ get_crm_log_level()

unsigned int get_crm_log_level ( void  )

Definition at line 1030 of file logging.c.

◆ 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 311 of file logging.c.

◆ pcmk__cli_init_logging()

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

Definition at line 1091 of file logging.c.

◆ set_crm_log_level()

unsigned int set_crm_log_level ( unsigned int  level)

Definition at line 984 of file logging.c.

Variable Documentation

◆ crm_log_level

unsigned int crm_log_level = LOG_INFO

Definition at line 45 of file logging.c.

◆ crm_trace_nonlog

unsigned int crm_trace_nonlog = 0

Definition at line 46 of file logging.c.

◆ pcmk__is_daemon

bool pcmk__is_daemon = false

Definition at line 47 of file logging.c.