Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Write Better Python Buggy Logs Logging

Logging

Can someone explain the basic concept of logging to me??? I just don't understand the point of it at all, and why did he use 'cat'

1 Answer

The point of logging events is to be able to review those logs if something's not acting properly, usually. Sometimes it's just to gather data and other times it's to optimize a process. If you notice that you're logging a certain process far more frequently than you'd expect, you'll be more inclined to review your code and see why that is the case. It's also used similarly to the Event Logger in Windows. If your game is crashing, you'll want to see what's happened right before it's crashing to see if you can isolate the event that's causing the crash.

The cat command had me confused, as well. It seems to be a Linux command, short for concatenate, and its use here seems identical to the python print() function. I suspect he used it because they're using a Linux console. I bet it's one of those things that just makes sense if you use Linux all of the time, but sticks out as strange if you're more accustomed to Windows.