Bug 33903

Summary: Use convenience methods of TpDebugSender
Product: Telepathy Reporter: Mikhail Zabaluev <mikhail.zabaluev>
Component: rakiaAssignee: Mikhail Zabaluev <mikhail.zabaluev>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium CC: david.laban, pekka.pessi
Version: git masterKeywords: patch
Hardware: All   
OS: All   
URL: http://cgit.freedesktop.org/~zabaluev/telepathy-rakia/log/?h=debug-lite
Whiteboard: review+
i915 platform: i915 features:
Bug Depends on: 33660    
Bug Blocks:    

Description Mikhail Zabaluev 2011-02-04 06:06:07 UTC
When bug #33660 is fixed, we need to use the utility to avoid costly logging of debug messages unconditionally.
Comment 1 Mikhail Zabaluev 2011-03-03 07:44:43 UTC
In fact, the new utilities only let me remove some code in Rakia.
Comment 2 Mikhail Zabaluev 2011-03-04 08:56:40 UTC
Repurposing this bug to clean up logging in telepathy-rakia, for which I have a branch up.
Formatting is still not avoided even if all logging is disabled.
Comment 3 Mikhail Zabaluev 2011-03-04 09:00:37 UTC
Note that the branch removes these public functions from rakia/debug.h:

rakia_sofia_log_init ()
rakia_sofia_log_finalize (gpointer logdata)
Comment 4 Mikhail Zabaluev 2011-03-04 09:15:05 UTC
(In reply to comment #2)
> Formatting is still not avoided even if all logging is disabled.

commit 5d568b09068ee1705ed1e35f12044f97e5a1ee85 fixes this, too.
Comment 5 David Laban 2011-03-04 09:47:48 UTC
Can we have a few tests for this please? I'm really bored of this breaking all the time.
Comment 6 David Laban 2011-05-30 21:13:29 UTC
I think this looks mostly sane. I will take a look at the test situation when I get time.

Minimum requirements should be that distcheck passes with ENABLE_DEBUG set to false, and telepathy-gabble/tests/twisted/test-debug.py is imported into rakia. These are the two tests that gabble does. If you can think of more then do tell.
Comment 7 David Laban 2011-05-31 15:21:34 UTC
Okay, so I added test-debug from gabble and made it a bit stricter http://cgit.freedesktop.org/~alsuren/telepathy-rakia/log/?h=test-debug. On origin/master, distcheck (with debugging disabled) fails (kind-of as expected).


I then merged your branch into mine (with a billion conflicts because of my rename :( ) and distcheck failed.

This was mostly because you fail to do:
#define DEBUG(format, ...) G_STMT_START { } G_STMT_END
to make it swallow the macro args properly (this is what gabble does) and then there were a few unused variable definitions that needed #ifdefing.

I fixed this in http://cgit.freedesktop.org/~alsuren/telepathy-rakia/log/?h=test-debug-lite

Taking a look at your code again, there are a few niggles that I fixed in my merge/post-merge commits, but:

-    DEBUG ("Couldn't resolv STUN server address, ignoring.");
+    MESSAGE ("could not resolve STUN server address, ignoring");

Is there any reason why you decided to break the case/punctuation in that debug message? Would it be better to instead standardise on correct case/punctuation in all debug messages?

Also, I don't like this: 
{
"created",
- "invite-sent",
- "invite-received",
- "response-received",
+ "invi-sent",
+ "invi-recv",
+ "resp-recv",
"active",
- "reinvite-sent",
- "reinvite-received",
- "reinvite-pending",
+ "rein-sent",
+ "rein-recv",
+ "rein-pend",
"ended"
};
so I reverted it.

Annoyingly, my merge commit makes gitg segfault. If you want to rebase your branch and check that it's all correct using git diff then that might be a good solution. Otherwise, I can try to fix gitg.
Comment 8 Mikhail Zabaluev 2011-09-05 06:58:16 UTC
(In reply to comment #7)
> http://cgit.freedesktop.org/~alsuren/telepathy-rakia/log/?h=test-debug-lite

Thank you. I have pulled that, updated with latest changes in master and added some more polish:

http://cgit.freedesktop.org/~zabaluev/telepathy-rakia/log/?h=debug-lite

I made sure it passes distcheck this time.
Comment 9 David Laban 2011-09-05 07:16:01 UTC
Looks good. Ship it.
Comment 10 Mikhail Zabaluev 2011-09-05 07:18:08 UTC
Merged and pushed into master.
Comment 11 Mikhail Zabaluev 2011-09-07 06:49:00 UTC
Released with telepathy-rakia 0.7.2.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.