importlogginglogger=logging.getLogger(__name__)defmain()->int:logger.info("Hello World!")return0if__name__=="__main__":# Log to file:fromloggingimportFileHandler,Formatterfile_formatter=Formatter("%(asctime)s :: %(name)s :: %(levelname)s :: %(message)s")file_handler=FileHandler(filename="activity.log",encoding="utf_8",)file_handler.setFormatter(file_formatter)file_handler.setLevel(logging.DEBUG)# Log to sys.stderr with rich text:fromrich.loggingimportRichHandlerstream_formatter=Formatter("%(message)s")stream_handler=RichHandler(rich_tracebacks=True)stream_handler.setFormatter(stream_formatter)stream_handler.setLevel(logging.DEBUG)# Main logging configuration:logging.basicConfig(level=logging.NOTSET,handlers=[file_handler,stream_handler,],)# Call main function:importsyssys.exit(main())