ppp: enable pppd debug logging when PPP log domain is enabled for debuggin

Instead of just with the old environment variable.  This means we'll
log pppd debug output when the log level is changed via the D-Bus
interface now too.
This commit is contained in:
Dan Williams 2011-05-19 13:31:52 -05:00
parent e083cd5c63
commit 6dae3c2f33
3 changed files with 13 additions and 2 deletions

View file

@ -218,6 +218,12 @@ nm_logging_level_enabled (guint32 level)
return !!(log_level & level);
}
gboolean
nm_logging_domain_enabled (guint32 domain)
{
return !!(log_domains & domain);
}
void
_nm_log (const char *loc,
const char *func,

View file

@ -95,6 +95,7 @@ void _nm_log (const char *loc,
const char *nm_logging_level_to_string (void);
char *nm_logging_domains_to_string (void);
gboolean nm_logging_level_enabled (guint32 level);
gboolean nm_logging_domain_enabled (guint32 domain);
/* Undefine the nm-utils.h logging stuff to ensure errors */
#undef nm_print_backtrace

View file

@ -798,7 +798,7 @@ create_pppd_cmd_line (NMPPPManager *self,
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
const char *ppp_binary;
NMCmdLine *cmd;
const char *ppp_debug;
gboolean ppp_debug;
g_return_val_if_fail (setting != NULL, NULL);
@ -819,7 +819,11 @@ create_pppd_cmd_line (NMPPPManager *self,
/* NM handles setting the default route */
nm_cmd_line_add_string (cmd, "nodefaultroute");
ppp_debug = getenv ("NM_PPP_DEBUG");
ppp_debug = !!getenv ("NM_PPP_DEBUG");
if ( nm_logging_level_enabled (LOGL_DEBUG)
&& nm_logging_domain_enabled (LOGD_PPP))
ppp_debug = TRUE;
if (ppp_debug)
nm_cmd_line_add_string (cmd, "debug");