mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-14 22:47:18 +00:00
20 lines
478 B
Python
20 lines
478 B
Python
import logging
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
class ConsoleLogsHandler:
|
|
keys = ['process.log.new']
|
|
|
|
def __init__(self, *, stream):
|
|
self.stream = stream
|
|
|
|
def handle_event(self, message, connector):
|
|
try:
|
|
connector.send_message({
|
|
'key': 'console.write',
|
|
'content': message[self.stream]
|
|
})
|
|
except KeyError:
|
|
LOG.error('Invalid %s message received: %s', self.keys, message)
|