Add new lasso_log_set_handler and lasso_log_remove_handler functions

They are modeled around the g_log... functions of GLib, they just don't
have a domain parameter.
This commit is contained in:
Frédéric Péters 2010-06-09 07:51:52 +00:00
parent baa4148645
commit 4c130d779a
4 changed files with 49 additions and 0 deletions

View File

@ -194,6 +194,8 @@
<struct name="LassoAuthentication" skip="true"/>
<func name="lasso_wsse_username_token_derive_key" skip="true"/>
<func name="lasso_wsa_endpoint_reference_add_security_token" skip="true"/>
<func name="lasso_log_set_handler" skip="true"/>
<func name="lasso_log_remove_handler" skip="true"/>
<!-- Exceptions -->
<exception>
<category name="Profile"/>

View File

@ -6132,3 +6132,10 @@ lasso_soap_envelope_sb2_get_redirect_request_url
lasso_soap_envelope_sb2_get_target_identity_header
lasso_soap_envelope_get_sb2_user_interaction_header
</SECTION>
<SECTION>
<FILE>logging</FILE>
<TITLE>Logging</TITLE>
lasso_log_set_handler
lasso_log_remove_handler
</SECTION>

View File

@ -2178,3 +2178,41 @@ lasso_set_string_from_prop(char **str, xmlNode *node, xmlChar *name, xmlChar *ns
}
lasso_release_xml_string(value);
}
/**
* lasso_log_set_handler:
* @log_levels: the log levels to apply the log handler for. To handle fatal
* and recursive messages as well, combine the log levels with the
* #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION bit flags.
* @log_func: the log handler function.
* @user_data: data passed to the log handler.
*
* Sets the log handler for a domain and a set of log levels. To handle fatal
* and recursive messages the @log_levels parameter must be combined with the
* #G_LOG_FLAG_FATAL and #G_LOG_FLAG_RECURSION bit flags.
*
* Note that since the #G_LOG_LEVEL_ERROR log level is always fatal, if you
* want to set a handler for this log level you must combine it with
* #G_LOG_FLAG_FATAL.
*
* Returns: the id of the new handler.
**/
guint
lasso_log_set_handler(GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data)
{
return g_log_set_handler("Lasso", log_levels, log_func, user_data);
}
/**
* lasso_log_remove_handler:
* @handler_id: the id of the handler, which was returned in
* lasso_log_set_handler().
*
* Removes the log handler.
**/
void
lasso_log_remove_handler(guint handler_id)
{
g_log_remove_handler("Lasso", handler_id);
}

View File

@ -26,5 +26,7 @@
#define __LASSO_TOOLS_H__
LASSO_EXPORT char* lasso_build_unique_id(unsigned int size);
LASSO_EXPORT guint lasso_log_set_handler(GLogLevelFlags log_levels, GLogFunc log_func, gpointer user_data);
LASSO_EXPORT void lasso_log_remove_handler(guint handler_id);
#endif /* __LASSO_TOOLS_H__ */