print('{}{}{}{}'.format(RESET, GREEN, msg, RESET)) #################### # Configure logger # #################### logger = logging.getLogger() ######### # Setup # ######### # The configuration file will not be distributed with this repo, due to the # fact that it contain sensitive information i.e. password. options = parse_config('NaiveLogger.yml') logging_file = NamedTemporaryFile() logging_queue = queue.Queue() logging_thread = LoggingThread(logging_queue, logging_file.name, maxSize='100 MB', backupCount=1000, **options['log']) if __name__ == "__main__": logging_thread.start() # Note that logging handling is in a separate thread, so that printout may # be out of order.
parser.add_argument( '--config-file', dest='configFile', help=''' specify configuration file. ''', type=str, default='DataServer.yml' ) return parser.parse_args() ######### # Setup # ######### args = parse_input() options = parse_config(args.configFile) logging_queue = Queue() logging_thread = LoggingThread(logging_queue, **options['log']) server = DataServer(**options['server']) if __name__ == "__main__": logging_thread.start() server.run() logging_thread.stop()