Python Write Better Python Buggy Logs Logging

Eldin Guzin
Eldin Guzin
2,595 Points

I don't get what does filename="game.log" do

I rewatched the video and just didn't get that part, I do not understand what does filename="game.log" do. An explanation would be really helpful.

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 62,884 Points

As seen in the logging documentation for basicConfig, the filename parameter can be used to specify the name to use when creating the logfile on disk. All output from logging will appear in this file.

Post back if you need more help. Good luck!!!

Akio Ito
Akio Ito
14,393 Points

Creates a new file called "game.log" and starts a tally of information that is passed into it. For example, new customer info may be continuously logged using:

logging.info("New customer created: {} {}".format(first_name, last_name))