diff --git a/cloudwatch/cloudwatch.py b/cloudwatch/cloudwatch.py index 5a3a5bd..8457dcb 100644 --- a/cloudwatch/cloudwatch.py +++ b/cloudwatch/cloudwatch.py @@ -84,20 +84,12 @@ def __init__(self, logging.Handler.__init__(self) def send_log(self, timestamp, log_entry): - #Send the message to AWS (function depends if there is a token or not) - if self.next_sequence_token: - response = self.logs.put_log_events(logGroupName=self.log_group, + #Send the message to AWS + self.logs.put_log_events(logGroupName=self.log_group, logStreamName=self.log_stream, - sequenceToken = self.next_sequence_token, + sequenceToken="", # ignored by PutLogEvents logEvents=[{'timestamp': timestamp,'message': log_entry}]) - else: - response = self.logs.put_log_events(logGroupName=self.log_group, - logStreamName=self.log_stream, - logEvents=[{'timestamp': timestamp,'message': log_entry}]) - - #Store the next token - self.next_sequence_token = response['nextSequenceToken'] - + def emit(self, record): """This is the overriden function from the handler to send logs to AWS """