Mercurial > libervia-web
diff browser_side/notification.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 | 4ba4b099d266 |
children |
line wrap: on
line diff
--- a/browser_side/notification.py Thu May 08 17:21:30 2014 +0200 +++ b/browser_side/notification.py Thu May 08 17:21:34 2014 +0200 @@ -1,4 +1,6 @@ from __pyjamas__ import JS, wnd +from sat.core.log import getLogger +log = getLogger(__name__) from pyjamas import Window from pyjamas.Timer import Timer from browser_side import dialog @@ -60,22 +62,22 @@ version_full = [s for s in self.user_agent.split() if "Chrome" in s][0].split('/')[1] version = int(version_full.split('.')[0]) except (IndexError, ValueError): - print "Can't find Chromium version" + log.warning("Can't find Chromium version") version = 0 - print "Chromium version: %d" % (version,) + log.info("Chromium version: %d" % (version,)) if version < 22: - print "Notification use the old prefixed version or are unmanaged" + log.info("Notification use the old prefixed version or are unmanaged") return if version < 32: dialog.InfoDialog(_("Notifications activation for Chromium"), _('You need to activate notifications manually for your Chromium version.<br/>To activate notifications, click on the favicon on the left of the address bar')).show() return - print "==> Installing Chromium notifications request workaround <==" + log.info("==> Installing Chromium notifications request workaround <==") self._old_click = wnd().onclick wnd().onclick = self._chromiumWorkaround def _chromiumWorkaround(self): - print "Activating workaround" + log.info("Activating workaround") JS(""" Notification.requestPermission(function(permission){ if (permission !== 'granted')