Merge lp:~kklimonda/couchdb-glib/clean-debug into lp:couchdb-glib

Proposed by Krzysztof Klimonda
Status: Merged
Merge reported by: Rodrigo Moya
Merged at revision: not available
Proposed branch: lp:~kklimonda/couchdb-glib/clean-debug
Merge into: lp:couchdb-glib
Diff against target: 78 lines (+10/-5)
3 files modified
couchdb-glib/Makefile.am (+2/-1)
couchdb-glib/couchdb-session.c (+7/-3)
couchdb-glib/xmalloc.c (+1/-1)
To merge this branch: bzr merge lp:~kklimonda/couchdb-glib/clean-debug
Reviewer Review Type Date Requested Status
Rodrigo Moya (community) Approve
Review via email: mp+34197@code.launchpad.net

Description of the change

Don't set up the custom log_handler for all debug messages. Instead define "Couchdb-GLib" log domain and handle only messages related to library itself.

To post a comment you must log in.
249. By Krzysztof Klimonda

don't translate libauth critical message

Revision history for this message
Rodrigo Moya (rodrigo-moya) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'couchdb-glib/Makefile.am'
2--- couchdb-glib/Makefile.am 2010-08-27 19:00:17 +0000
3+++ couchdb-glib/Makefile.am 2010-08-31 13:46:00 +0000
4@@ -9,7 +9,8 @@
5 endif
6
7 INCLUDES = \
8- $(COUCHDB_GLIB_CFLAGS)
9+ $(COUCHDB_GLIB_CFLAGS) \
10+ -DG_LOG_DOMAIN=\"Couchdb-GLib\"
11
12 lib_LTLIBRARIES = libcouchdb-glib-1.0.la
13
14
15=== modified file 'couchdb-glib/couchdb-session.c'
16--- couchdb-glib/couchdb-session.c 2010-08-31 11:55:28 +0000
17+++ couchdb-glib/couchdb-session.c 2010-08-31 13:46:00 +0000
18@@ -193,7 +193,7 @@
19 session->priv->credentials = NULL;
20
21 #ifdef DEBUG_MESSAGES
22- g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, debug_message, NULL);
23+ g_log_set_handler ("Couchdb-GLib", G_LOG_LEVEL_DEBUG, debug_message, NULL);
24 #endif
25 }
26
27@@ -562,7 +562,9 @@
28
29 if (retrying) {
30 g_signal_emit_by_name (session, COUCHDB_SIGNAL_AUTHENTICATION_FAILED, NULL);
31+#ifdef DEBUG_MESSAGES
32 g_debug ("Authentication failed!");
33+#endif
34 return FALSE;
35 }
36
37@@ -664,7 +666,9 @@
38 }
39
40 if (str && str->len > 0) {
41+#ifdef DEBUG_MESSAGES
42 g_debug ("Response body: %s", str->str);
43+#endif
44 if (!json_parser_load_from_data (json_parser,
45 (const gchar *) str->str,
46 str->len,
47@@ -726,8 +730,8 @@
48 }
49 }
50
51- g_debug ("Sending %s to %s... with headers\n: ", method, url);
52 #ifdef DEBUG_MESSAGES
53+ g_debug ("Sending %s to %s... with headers: ", method, url);
54 soup_message_headers_foreach (http_message->request_headers,
55 (SoupMessageHeadersForeachFunc) debug_print_headers,
56 NULL);
57@@ -763,7 +767,7 @@
58
59 couchdb_env_debug_messages = g_getenv(COUCHDB_ENV_DEBUG_MESSAGES);
60 if (couchdb_env_debug_messages != NULL) {
61- g_print ("couchdb-glib:DEBUG: %s\n", message);
62+ g_print ("%s-DEBUG: %s\n", log_domain, message);
63 }
64 }
65 #endif
66
67=== modified file 'couchdb-glib/xmalloc.c'
68--- couchdb-glib/xmalloc.c 2010-01-15 10:09:48 +0000
69+++ couchdb-glib/xmalloc.c 2010-08-31 13:46:00 +0000
70@@ -86,7 +86,7 @@
71 {
72 /* possible revisions: release some memory and re-try, print
73 more information (e.g. line number of input file) */
74- g_debug(_("liboauth: Memory exhausted"));
75+ g_critical("liboauth: Memory exhausted");
76 exit(1);
77 }
78 return p;

Subscribers

People subscribed via source and target branches