Mercurial > libervia-backend
diff src/plugins/plugin_misc_radiocol.py @ 993:301b342c697a
core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 19 Apr 2014 19:19:19 +0200 |
parents | c6d8fc63b1db |
children | 83ed877541e3 |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_radiocol.py Sat Apr 19 16:48:26 2014 +0200 +++ b/src/plugins/plugin_misc_radiocol.py Sat Apr 19 19:19:19 2014 +0200 @@ -18,7 +18,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from sat.core.i18n import _, D_ -from logging import debug, info, warning, error +from sat.core.log import getLogger +log = getLogger(__name__) from twisted.words.xish import domish from twisted.internet import reactor from twisted.words.protocols.jabber import jid @@ -63,7 +64,7 @@ self.__class__ = type(self.__class__.__name__, (self.__class__, RoomGame, object), {}) def __init__(self, host): - info(_("Radio collective initialization")) + log.info(_("Radio collective initialization")) self.inheritFromRoomGame(host) RoomGame._init_(self, host, PLUGIN_INFO, (NC_RADIOCOL, RADIOC_TAG), game_init={'queue': [], 'upload': True, 'playing': None, 'playing_time': 0, 'to_delete': {}}) @@ -135,7 +136,7 @@ # ==> unlink done the Q&D way with the same host trick (see above) radio_data = self.games[room_jid.userhost()] if len(radio_data['players']) == 0: - debug(_('No more participants in the radiocol: cleaning data')) + log.debug(_('No more participants in the radiocol: cleaning data')) radio_data['queue'] = [] for filename in radio_data['to_delete']: self.deleteFile(filename, radio_data) @@ -171,14 +172,14 @@ try: file_to_delete = radio_data['to_delete'][filename] except KeyError: - error(_("INTERNAL ERROR: can't find full path of the song to delete")) + log.error(_("INTERNAL ERROR: can't find full path of the song to delete")) return False else: file_to_delete = filename try: unlink(file_to_delete) except OSError: - error(_("INTERNAL ERROR: can't find %s on the file system" % file_to_delete)) + log.error(_("INTERNAL ERROR: can't find %s on the file system" % file_to_delete)) return False return True @@ -241,7 +242,7 @@ # songs in queue. We can now start the party :) self.playNext(room_jid, profile) else: - error(_('Unmanaged game element: %s') % elt.name) + log.error(_('Unmanaged game element: %s') % elt.name) def getSyncDataForPlayer(self, room_jid_s, nick): game_data = self.games[room_jid_s]