logging.basicConfig(level=logging.INFO
filename="new.log",
filemode="a",
format="%(asctime)s - %(levelname)s: %(message)s"
)
now I want to add a custom variable to format, such as appname,
look up the usage of logging.info on the Internet, as follows:
logging.info (msg, args, * kwargs)
then I modify format="% (asctime) s -% (levelname) s:% (appname) s% (message) s"), add a% (appname) s,
, and then run logging.info (msg, appname="xxx") with an error.
how can I implement the above requirements?