Ejemplo n.º 1
0
 def _log(self, message, level):
     if (self._loglevel >= level):
         for line in message.split('\n'):
             output = "(" + str(level) + ") " + self._name + ":"
             output = output.ljust(15)
             output = output + util.try_encode(line, 'utf-8')
             print(output)
Ejemplo n.º 2
0
 def _log(self, message, level):
     if(self._loglevel >= level):
         for line in message.split('\n'):
             output = "(" + str(level) + ") " + self._name + ":"
             output = output.ljust(15)
             output = output + util.try_encode(line, 'utf-8')
             print(output)
Ejemplo n.º 3
0
 def _sendMessageUnsafe(self, message):
     """
     write the message to stdout
     """
     print(util.try_encode(message, self._encoding))
     sys.stdout.flush()
     return True
Ejemplo n.º 4
0
 def _sendMessageUnsafe(self, message):
     """
     send the given line via the socket.
     """
     self._log("tx: " + message, 3)
     try:
         self._socket.send(util.try_encode(message, self._encoding) + "\n")
     except Exception as e:
         self._log("failed sending %s: " % (message) + str(e), 1)
         return False
     return True
Ejemplo n.º 5
0
 def _sendMessageUnsafe(self, message):
     """
     send the given line via the socket.
     """
     self._log("tx: " + message, 3)
     try:
         self._socket.send(util.try_encode(message, self._encoding) + "\n")
     except Exception as e:
         self._log("failed sending %s: " % (message) + str(e), 1)
         return False
     return True
 def _sendMessageUnsafe(self, message):
     """
     write the message to stdout
     """
     print(util.try_encode(message, self._encoding))
     return True