After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 638609 - libfolks hard-codes backend names for debugging
libfolks hard-codes backend names for debugging
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: libfolks
git master
Other Linux
: Normal normal
: folks-0.3.4
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2011-01-03 21:27 UTC by Travis Reitter
Modified: 2011-01-06 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Set backend debugging dynamically as they're added (8.87 KB, patch)
2011-01-04 20:26 UTC, Travis Reitter
accepted-commit_now Details | Review

Description Travis Reitter 2011-01-03 21:27:54 UTC
See folks/debug.vala:Folks.Debug.set_flags.keys

This is inconvenient for in-tree backends, and obviously bad for out-of-tree backends.

We should probably have some registration hook for the backends to call when they're discovered.
Comment 1 Travis Reitter 2011-01-04 20:26:14 UTC
Created attachment 177516 [details] [review]
Set backend debugging dynamically as they're added

Squashed diff of branch:

http://git.collabora.co.uk/?p=user/treitter/folks.git;a=shortlog;h=refs/heads/bgo638609-debugging
Comment 2 Philip Withnall 2011-01-06 10:35:26 UTC
Review of attachment 177516 [details] [review]:

Looks good to me apart from the two comments below. I'm fine with it being committed once these issues have been resolved.

::: backends/key-file/kf-backend.vala
@@ +52,3 @@
    * {@inheritDoc}
    */
+  public override string name { get { return G_LOG_DOMAIN; } }

Setting the backend name to be the log domain of the backend seems a little backwards to me, though I can understand the reasoning (and agree with it). How about defining the backend name in Makefile.am as (e.g.) BACKEND_NAME, and setting both G_LOG_DOMAIN and Backend.name to be equal to it?

::: folks/backend-store.vala
@@ +124,3 @@
+
+      /* register the core debug messages */
+      this._debug._register_domain ("folks");

Might it be better to use G_LOG_DOMAIN here so that this will continue to work even if we change the value of G_LOG_DOMAIN in future?
Comment 3 Travis Reitter 2011-01-06 23:48:50 UTC
Fixed the two issues and merged:

commit b4b63b8e706b87fd2b927a1b930024803411075e
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Thu Jan 6 15:48:08 2011 -0800

    Note the fix of bgo#638609 in the NEWS

 NEWS |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

commit cfdd138a035c6aa13889660852e13b2fb458dbd5
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Thu Jan 6 15:39:20 2011 -0800

    Register core debugging as global G_LOG_DOMAIN to reduce magic strings.
    
    Fixes bgo#638609 - libfolks hard-codes backend names for debugging

 folks/backend-store.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

commit cf95d8dcce95840188c510d0f1cfe78af7a44ecc
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Tue Jan 4 12:19:27 2011 -0800

    Pin backends' names to global BACKEND_NAME to reduce magic strings.
    
    Helps bgo#638609 - libfolks hard-codes backend names for debugging

 backends/key-file/Makefile.am                 |    5 ++++-
 backends/key-file/kf-backend.vala             |    4 +++-
 backends/key-file/kf-persona-store.vala       |    2 +-
 backends/telepathy/Makefile.am                |    4 +++-
 backends/telepathy/backend.mk                 |    1 +
 backends/telepathy/lib/Makefile.am            |    4 +++-
 backends/telepathy/lib/tpf-persona-store.vala |    5 +++--
 backends/telepathy/tp-backend.vala            |    4 +++-
 8 files changed, 21 insertions(+), 8 deletions(-)

commit efe8d5d6dd1497f4a23bb27323901dabb9a6406f
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Tue Jan 4 10:58:15 2011 -0800

    Make the main debug domain 'folks' to match the backends.
    
    Helps bgo#638609 - libfolks hard-codes backend names for debugging

 folks/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

commit 7b39b7188be6bf37925f76615c9004c5151e543c
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Tue Jan 4 10:51:49 2011 -0800

    Make the backends' log domains match their type_id.
    
    Helps bgo#638609 - libfolks hard-codes backend names for debugging

 backends/key-file/Makefile.am      |    2 +-
 backends/telepathy/Makefile.am     |    2 +-
 backends/telepathy/lib/Makefile.am |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

commit e962ee0505a30b89e143a87db7fcfec4c31b1ee7
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Tue Jan 4 11:26:34 2011 -0800

    Push flag setting into the Debug constructor.
    
    Helps bgo#638609 - libfolks hard-codes backend names for debugging

 folks/backend-store.vala |    5 +--
 folks/debug.vala         |   49 +++++++++++++++++++++------------------------
 2 files changed, 25 insertions(+), 29 deletions(-)

commit 74966cd86b4b213eaad81bcb5c8d5a2738ba1f8c
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Tue Jan 4 10:54:01 2011 -0800

    Add new API for setting debugging levels.
    
    Helps bgo#638609 - libfolks hard-codes backend names for debugging

 folks/backend-store.vala |    9 ++++++-
 folks/debug.vala         |   49 +++++++++++++++++++++++++++++----------------
 2 files changed, 38 insertions(+), 20 deletions(-)

commit 26f43d1aeeadf48a23cf6fb29d7900720fd4a6ea
Author: Travis Reitter <travis.reitter@collabora.co.uk>
Date:   Mon Jan 3 16:23:05 2011 -0800

    Make Folks.Debug a class so we can store state.
    
    Helps bgo#638609 - libfolks hard-codes backend names for debugging

 folks/backend-store.vala |    4 +++-
 folks/debug.vala         |   27 +++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 3 deletions(-)