core: use of the new core.log module:

/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
This commit is contained in:
Goffi 2014-04-19 19:19:19 +02:00
commit 501bc92528

View file

@ -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 @@ class Radiocol(object):
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 @@ class Radiocol(object):
# ==> 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 @@ class Radiocol(object):
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 @@ class Radiocol(object):
# 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]