[gnome-music/gnome-3-12] Use a logger for all modules



commit c0fed189409df44961732efadece660ec63daf9e
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Tue Apr 1 17:57:08 2014 +0200

    Use a logger for all modules

 gnome-music.in            |    4 +++-
 gnomemusic/application.py |   17 +++++++++--------
 gnomemusic/grilo.py       |    3 ++-
 3 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/gnome-music.in b/gnome-music.in
index ea51e7d..3bade7c 100644
--- a/gnome-music.in
+++ b/gnome-music.in
@@ -66,7 +66,9 @@ if __name__ == "__main__":
         if '--debug' in sys.argv:
             sys.argv.remove("--debug")
     else:
-        logging.basicConfig(level=logging.WARN)
+        logging.basicConfig(level=logging.WARN,
+                            format='%(asctime)s %(levelname)s\t%(filename)s:%(lineno)d \t%(message)s',
+                            datefmt='%H:%M:%S')
 
     locale.bindtextdomain('gnome-music', localedir)
     locale.textdomain('gnome-music')
diff --git a/gnomemusic/application.py b/gnomemusic/application.py
index 146feed..f0f0c4b 100644
--- a/gnomemusic/application.py
+++ b/gnomemusic/application.py
@@ -37,11 +37,12 @@ from gnomemusic.window import Window
 from gnomemusic.mpris import MediaPlayer2Service
 from gnomemusic.notification import NotificationManager
 import logging
+log = logging.getLogger(__name__)
 
 
 class Application(Gtk.Application):
     def __init__(self):
-        logging.debug("Creating app")
+        log.debug("Creating app")
         Gtk.Application.__init__(self,
                                  application_id='org.gnome.Music',
                                  flags=Gio.ApplicationFlags.FLAGS_NONE)
@@ -58,7 +59,7 @@ class Application(Gtk.Application):
         self._window = None
 
     def build_app_menu(self):
-        logging.debug("building app menu")
+        log.debug("building app menu")
         builder = Gtk.Builder()
 
         builder.add_from_resource('/org/gnome/Music/app-menu.ui')
@@ -83,15 +84,15 @@ class Application(Gtk.Application):
         self.add_action(quitAction)
 
     def new_playlist(self, action, param):
-        logging.debug("TODO: New playlist action")
+        log.debug("TODO: New playlist action")
         pass
 
     def help(self, action, param):
-        logging.debug("Open Help action")
+        log.debug("Open Help action")
         Gtk.show_uri(None, "help:gnome-music", Gdk.CURRENT_TIME)
 
     def about(self, action, param):
-        logging.debug("About action")
+        log.debug("About action")
         builder = Gtk.Builder()
         builder.add_from_resource('/org/gnome/Music/AboutDialog.ui')
         about = builder.get_object('about_dialog')
@@ -100,11 +101,11 @@ class Application(Gtk.Application):
         about.show()
 
     def about_response(self, dialog, response):
-        logging.debug("Close about")
+        log.debug("Close about")
         dialog.destroy()
 
     def do_startup(self):
-        logging.debug("app is starting up")
+        log.debug("app is starting up")
         Gtk.Application.do_startup(self)
 
         Notify.init(_("Music"))
@@ -116,7 +117,7 @@ class Application(Gtk.Application):
         self._window.destroy()
 
     def do_activate(self):
-        logging.debug("App is activated")
+        log.debug("App is activated")
         if not self._window:
             self._window = Window(self)
             self.service = MediaPlayer2Service(self)
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index e4cde47..2b52037 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -25,7 +25,8 @@
 # code, but you are not obligated to do so.  If you do not wish to do so,
 # delete this exception statement from your version.
 
-
+import logging
+log = logging.getLogger(__name__)
 from gi.repository import Grl, GLib, GObject
 
 from gnomemusic.query import Query


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]