diff browser_side/radiocol.py @ 439:d52f529a6d42

browser side: use of new log system (first draft): - configuration is hardcoded in libervia.py, it will change in the (hopefuly) near future - log level is DEBUG for the moment, will be changed to INFO when configuration will not be hardcoded anymore - the basic log backend is used, in the future, a console.debug/info/etc should be used instead. A log widget which HTML colors is also an option
author Goffi <goffi@goffi.org>
date Thu, 08 May 2014 17:21:34 +0200
parents 20c508f9b32a
children
line wrap: on
line diff
--- a/browser_side/radiocol.py	Thu May 08 17:21:30 2014 +0200
+++ b/browser_side/radiocol.py	Thu May 08 17:21:34 2014 +0200
@@ -18,6 +18,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import pyjd  # this is dummy in pyjs
+from sat.core.log import getLogger
+log = getLogger(__name__)
 from pyjamas.ui.VerticalPanel import VerticalPanel
 from pyjamas.ui.HorizontalPanel import HorizontalPanel
 from pyjamas.ui.FlexTable import FlexTable
@@ -198,7 +200,7 @@
         self.album = album
         self.played = False
         self.setSrc("radiocol/%s" % html_sanitize(filename))
-        print "preloading %s in %s" % (title, self._id)
+        log.debug("preloading %s in %s" % (title, self._id))
 
     def play(self, play=True):
         """Play or pause the song
@@ -291,7 +293,7 @@
                 preloaded = True
                 break
         if not preloaded:
-            print(_("WARNING: Can't preload song, we are getting too many songs to preload, we shouldn't have more than %d at once") % self.queue_data[1])
+            log.warning("Can't preload song, we are getting too many songs to preload, we shouldn't have more than %d at once" % self.queue_data[1])
         else:
             self.pushNextSong(title)
             self._parent.printInfo(_('%(user)s uploaded %(artist)s - %(title)s') % {'user': sender, 'artist': artist, 'title': title})
@@ -307,7 +309,7 @@
             else:
                 player.play(False)  # in case the previous player was not sync
         if not found:
-            print("WARNING: Song not found in queue, can't play it. This should not happen")
+            log.error("Song not found in queue, can't play it. This should not happen")
 
     def radiocolNoUpload(self):
         self.control_panel.blockUpload()