コード例 #1
0
 def __send_to_file(self):
     """
     This function sends the data to the output file.
     """
     file_ext = FileHelper.get_ext(self.output_file)
     response = FileHelper.send_to_file(self.output_file, self.message,
                                        file_ext, True)
     if not response:  # TODO: quickfix.. write better error message/ use better structure.
         sys.stdout.write("Unhandled log filename specified.")
コード例 #2
0
 def send(self) -> dict:
     """
     This function sends data to a file.
     Output:
         - dict
     """
     # NOTE: potentially move 'try' block to this method
     data = {'message': self.args['data'], 'filename': self.filename}
     file_ext = FileHelper.get_ext(self.filename)
     status = FileHelper.send_to_file(
         self.filename,
         self.args['data'],
         file_ext,
         self.args['new_line']
     )
     return ServiceHelper.construct_response(status, data)