Changeset - 6b101309fb12
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 7 years ago 2018-06-08 05:40:02
drewp@bigasterisk.com
collector logging
Ignore-this: b6ed23697ded6a40151ff0cca98b334
2 files changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
bin/collector
Show inline comments
 
@@ -63,13 +63,13 @@ class WebListeners(object):
 
        self.clients = []
 
        self.pendingMessageForDev = {} # dev: (attrs, outputmap)
 
        self.lastFlush = 0
 
        
 
    def addClient(self, client):
 
        self.clients.append([client, {}]) # seen = {dev: attrs}
 
        log.info('added client %s', client)
 
        log.info('added client %s %s', len(clients), client)
 

	
 
    def delClient(self, client):
 
        self.clients = [[c, t] for c, t in self.clients if c != client]
 
        log.info('delClient %s, %s left', client, len(self.clients))
 
        
 
    def outputAttrsSet(self, dev, attrs, outputMap):
light9/collector/output.py
Show inline comments
 
@@ -132,12 +132,13 @@ class Udmx(DmxOutput):
 
    stats = scales.collection('/output/udmx',
 
                              scales.PmfStat('update'),
 
                              scales.PmfStat('write'),
 
                              scales.IntStat('usbErrors'))
 
    def __init__(self, uri, bus, numChannels):
 
        DmxOutput.__init__(self, uri, numChannels)
 
        self._shortId = self.uri.rstrip('/')[-1]
 
        
 
        from light9.io.udmx import Udmx
 
        self.dev = Udmx(bus)
 
        self.currentBuffer = ''
 
        self.lastSentBuffer = None
 
        self.lastLog = 0
 
@@ -152,13 +153,13 @@ class Udmx(DmxOutput):
 
        self._loop()
 

	
 
    @stats.update.time()
 
    def update(self, values):
 
        now = time.time()
 
        if now > self.lastLog + 1:
 
            log.info('udmx %s', ' '.join(map(str, values)))
 
            log.info('%s %s', self.shortId(), ' '.join(map(str, values)))
 
            self.lastLog = now
 

	
 
        self.currentBuffer = ''.join(map(chr, values))
 

	
 
    def sendDmx(self, buf):
 
        with Udmx.stats.write.time():
 
@@ -171,8 +172,8 @@ class Udmx(DmxOutput):
 

	
 
    def countError(self):
 
        # in main thread
 
        Udmx.stats.usbErrors += 1
 
        
 
    def shortId(self):
 
        return 'udmx' # and something unique from self.dev?
 
        return self._shortId
 

	
0 comments (0 inline, 0 general)