From: pin Date: Thu, 15 Apr 2010 13:13:41 +0000 (+0000) Subject: début d'organisation du logging. X-Git-Url: https://svn.cri.ensmp.fr/git/minwii.git/commitdiff_plain/b2d4a94dcd881e16c188b1efcb253f24873d8616?ds=inline début d'organisation du logging. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@142 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/app/event_pprinters.py b/src/app/event_pprinters.py index 2f77809..0f56915 100755 --- a/src/app/event_pprinters.py +++ b/src/app/event_pprinters.py @@ -1,9 +1,21 @@ +# -*- coding: utf-8 -*- +""" +formatage des événements + +$Id$ +$URL$ +""" + from events import eventNames import sys self = sys.modules[__name__] def log_COLDOWN(e) : - return '%s' % e.column.tone.nom + tone = e.column.tone + return '%s (%s)' % (e.midi, e.nom) + +def log_COLSTATECHANGE(e) : + return u'%5s %s' % (e.state, e.syllabus) def log_default(e) : return str(e) diff --git a/src/app/eventutils.py b/src/app/eventutils.py index f95a828..c0aada5 100755 --- a/src/app/eventutils.py +++ b/src/app/eventutils.py @@ -29,18 +29,7 @@ $URL$ import types import pygame from StringIO import StringIO -from logging import getLogger, basicConfig, DEBUG -import sys -from events import TIMEOUT, COLOVER, eventNames -basicConfig(level=DEBUG, stream = sys.stdout) -console = getLogger('minwii') -eventLog = getLogger('minwii.events') - -hiddenEvents = {pygame.MOUSEMOTION:True, - TIMEOUT:True, - #COLOVER:True, - } -from event_pprinters import pprinters +from log import console, eventLog, hiddenEvents, pprinters class _EventDispatcher : def __init__(self) : diff --git a/src/app/log.py b/src/app/log.py new file mode 100755 index 0000000..457866b --- /dev/null +++ b/src/app/log.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +""" +utilitaires pour tracer l'activité de miiwii + +$Id$ +$URL$ +""" + +from events import TIMEOUT, COLOVER, eventNames +from event_pprinters import pprinters +import sys +import pygame +from logging import basicConfig, getLogger, DEBUG + +basicConfig(level=DEBUG, stream = sys.stdout) +console = getLogger('minwii') +eventLog = getLogger('minwii.events') + +hiddenEvents = {pygame.MOUSEMOTION:True, + TIMEOUT:True, + #COLOVER:True, + }