mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 02:20:12 +01:00
libnm-glib: add nm_client_set_logging() for setting debugging level and domains
This commit is contained in:
parent
4ce355022c
commit
0309bdc2e0
3 changed files with 39 additions and 0 deletions
|
|
@ -49,6 +49,7 @@ global:
|
|||
nm_client_new_finish;
|
||||
nm_client_permission_get_type;
|
||||
nm_client_permission_result_get_type;
|
||||
nm_client_set_logging;
|
||||
nm_client_sleep;
|
||||
nm_client_wimax_get_enabled;
|
||||
nm_client_wimax_hardware_get_enabled;
|
||||
|
|
|
|||
|
|
@ -1084,6 +1084,43 @@ nm_client_get_logging (NMClient *client, char **level, char **domains, GError **
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_client_set_logging:
|
||||
* @client: a #NMClient
|
||||
* @level: (allow-none): logging level to set (%NULL or an empty string for no change)
|
||||
* @domains: (allow-none): logging domains to set. The string should be a list of log
|
||||
* domains separated by ",". (%NULL or an empty string for no change)
|
||||
* @error: (allow-none): return location for a #GError, or %NULL
|
||||
*
|
||||
* Sets NetworkManager logging level and/or domains.
|
||||
*
|
||||
* Returns: %TRUE on success, %FALSE otherwise
|
||||
**/
|
||||
gboolean
|
||||
nm_client_set_logging (NMClient *client, const char *level, const char *domains, GError **error)
|
||||
{
|
||||
GError *err = NULL;
|
||||
|
||||
g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (!level && !domains)
|
||||
return TRUE;
|
||||
|
||||
if (!dbus_g_proxy_call (NM_CLIENT_GET_PRIVATE (client)->client_proxy, "SetLogging", &err,
|
||||
G_TYPE_STRING, level ? level : "",
|
||||
G_TYPE_STRING, domains ? domains : "",
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_INVALID)) {
|
||||
if (error)
|
||||
*error = g_error_copy (err);
|
||||
g_error_free (err);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ NMClientPermissionResult nm_client_get_permission_result (NMClient *client,
|
|||
NMClientPermission permission);
|
||||
|
||||
gboolean nm_client_get_logging (NMClient *client, char **level, char **domain, GError **error);
|
||||
gboolean nm_client_set_logging (NMClient *client, const char *level, const char *domain, GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue