(self)
Convert message to a json object and send to Lognetries
Convert message to a json object and send to Lognetries
Convert message to a json object and send to Lognetries
def _send(self):
        """
        Convert message to a json object and send to Lognetries
        """
        while len(self.queue) > 0:
            metric = self.queue.popleft()
            topic, value, timestamp = str(metric).split()
            msg = json.dumps({"event": {topic: value}})
            req = urllib2.Request("https://js.logentries.com/v1/logs/" +
                                  self.log_token, msg)
            try:
                urllib2.urlopen(req)
            except urllib2.URLError as e:
                logging.error("Can't send log message to Logentries %s", e)
def _send ( self ) : while len ( self . queue ) > 0 : metric = self . queue . popleft ( ) topic , value , timestamp = str ( metric ) . split ( ) msg = json . dumps ( { "event" : { topic : value } } ) req = urllib2 . Request ( "https://js.logentries.com/v1/logs/" + self . log_token , msg ) try : urllib2 . urlopen ( req ) except urllib2 . URLError as e : logging . error ( "Can't send log message to Logentries %s" , e )