import logging from xapp_control import * def main(): # configure logger and console output logging.basicConfig(level=logging.DEBUG, filename='/home/xapp-logger.log', filemode='a+', format='%(asctime)-15s %(levelname)-8s %(message)s') formatter = logging.Formatter('%(asctime)-15s %(levelname)-8s %(message)s') console = logging.StreamHandler() console.setLevel(logging.INFO) console.setFormatter(formatter) logging.getLogger('').addHandler(console) control_sck = open_control_socket(4200) while True: data_sck = receive_from_socket(control_sck) if len(data_sck) <= 0: if len(data_sck) == 0: continue else: logging.info('Negative value for socket') break else: logging.info('Received data: ' + repr(data_sck)) if __name__ == '__main__': main()