From b2d4a94dcd881e16c188b1efcb253f24873d8616 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 15 Apr 2010 13:13:41 +0000 Subject: [PATCH] =?utf8?q?d=C3=A9but=20d'organisation=20du=20logging.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@142 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/app/event_pprinters.py | 14 +++++++++++++- src/app/eventutils.py | 13 +------------ src/app/log.py | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 13 deletions(-) create mode 100755 src/app/log.py 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, + } -- 2.20.1