Skip to content

Commit

Permalink
Update log.* (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvillalba committed Oct 8, 2011
1 parent bf9be85 commit 73cf772
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/ant/core/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

import msgpack

from ant.core import message

EVENT_OPEN = 0x01
EVENT_CLOSE = 0x02
EVENT_READ = 0x03
Expand Down Expand Up @@ -66,7 +68,8 @@ def close(self):

def read(self):
try:
return self.unpacker.unpack()
msg = message.Message()
return msg.getHandler(self.unpacker.unpack())
except StopIteration:
return None

Expand Down Expand Up @@ -117,8 +120,8 @@ def logOpen(self):
def logClose(self):
self._logEvent(EVENT_CLOSE)

def logRead(self, data):
self._logEvent(EVENT_READ, data)
def logRead(self, msg):
self._logEvent(EVENT_READ, msg.encode())

def logWrite(self, data):
self._logEvent(EVENT_WRITE, data)
def logWrite(self, msg):
self._logEvent(EVENT_WRITE, msg.encode())

0 comments on commit 73cf772

Please sign in to comment.