summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2010-06-09 07:51:52 +0000
committerFrederic Peters <fpeters@entrouvert.com>2010-06-09 07:51:52 +0000
commit4c130d779aff0d043c17c1087180af64d5288cf4 (patch)
tree46dede792b6dd2f4990b2961fb92d2e5a805bdb2
parentbaa41486459da0a79f069649cec4e9a773407669 (diff)
downloadlasso-4c130d779aff0d043c17c1087180af64d5288cf4.tar.gz
lasso-4c130d779aff0d043c17c1087180af64d5288cf4.tar.xz
lasso-4c130d779aff0d043c17c1087180af64d5288cf4.zip
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.
-rw-r--r--bindings/overrides.xml2
-rw-r--r--docs/reference/lasso/lasso-sections.txt7
-rw-r--r--lasso/xml/tools.c38
-rw-r--r--lasso/xml/tools.h2
4 files changed, 49 insertions, 0 deletions
diff --git a/bindings/overrides.xml b/bindings/overrides.xml
index 42a8b684..19c92a46 100644
--- a/bindings/overrides.xml
+++ b/bindings/overrides.xml
@@ -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"/>
diff --git a/docs/reference/lasso/lasso-sections.txt b/docs/reference/lasso/lasso-sections.txt
index a054ba1c..2e2908f0 100644
--- a/docs/reference/lasso/lasso-sections.txt
+++ b/docs/reference/lasso/lasso-sections.txt
@@ -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>
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c
index 7b967352..7e901b15 100644
--- a/lasso/xml/tools.c
+++ b/lasso/xml/tools.c
@@ -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);
+}
diff --git a/lasso/xml/tools.h b/lasso/xml/tools.h
index 8dfdcd61..639269fb 100644
--- a/lasso/xml/tools.h
+++ b/lasso/xml/tools.h
@@ -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__ */