MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / crm_log_init

Function crm_log_init

lib/common/logging.c:569–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567}
568
569gboolean
570crm_log_init(const char *entity, int level, gboolean daemon, gboolean to_stderr,
571 int argc, char **argv, gboolean quiet)
572{
573 int lpc = 0;
574 const char *logfile = daemon_option("debugfile");
575 const char *facility = daemon_option("logfacility");
576 const char *f_copy = facility;
577
578 if(crm_trace_nonlog == 0) {
579 crm_trace_nonlog = g_quark_from_static_string("Pacemaker non-logging tracepoint");
580 }
581
582 umask(S_IWGRP | S_IWOTH | S_IROTH);
583
584 /* Redirect messages from glib functions to our handler */
585#ifdef HAVE_G_LOG_SET_DEFAULT_HANDLER
586 glib_log_default = g_log_set_default_handler(crm_glib_handler, NULL);
587#endif
588
589 /* and for good measure... - this enum is a bit field (!) */
590 g_log_set_always_fatal((GLogLevelFlags) 0); /*value out of range */
591
592 if (facility == NULL) {
593 facility = "daemon";
594
595 } else if(safe_str_eq(facility, "none")) {
596 facility = "daemon";
597 quiet = TRUE;
598 }
599
600 if (entity) {
601 crm_system_name = entity;
602
603 } else if (argc > 0 && argv != NULL) {
604 char *mutable = strdup(argv[0]);
605
606 crm_system_name = basename(mutable);
607 if (strstr(crm_system_name, "lt-") == crm_system_name) {
608 crm_system_name += 3;
609 }
610
611 } else if (crm_system_name == NULL) {
612 crm_system_name = "Unknown";
613 }
614
615 setenv("PCMK_service", crm_system_name, 1);
616
617 if (daemon_option_enabled(crm_system_name, "debug")) {
618 /* Override the default setting */
619 level = LOG_DEBUG;
620 }
621
622 if (daemon_option_enabled(crm_system_name, "stderr")) {
623 /* Override the default setting */
624 to_stderr = TRUE;
625 }
626

Callers 14

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
crm_log_cli_initFunction · 0.85
mainFunction · 0.85

Calls 13

daemon_optionFunction · 0.85
setenvFunction · 0.85
daemon_option_enabledFunction · 0.85
set_format_stringFunction · 0.85
crm_enable_stderrFunction · 0.85
crm_add_logfileFunction · 0.85
crm_enable_blackboxFunction · 0.85
set_daemon_optionFunction · 0.85
crm_tracing_enabledFunction · 0.85
crm_update_callsitesFunction · 0.85
crm_log_argsFunction · 0.85
safe_str_neqFunction · 0.85

Tested by 2

mainFunction · 0.68
mainFunction · 0.68