How to write a Logging System (c++) |
|---|
You might be asking yourself, (1) what is a logging system, (2) what can it do for me, and (3) why should I care? Well, to answer your questions.
Now, having read the above, you might be asking yourself: "why not just use printf to log the current status of the program. " That might sound reasonable at first, and for small projects, you might be able to get away with it. But if you plan on working on a project with more then 200 lines of code, you may consider using a log file. Unlike printf, a log file can be accessed without having to compile your program with a console window. Also, most applications arn't distributed with a console window hanging in the background, so your user has no way of seeing the output. However, the user does have access to the log file. A log file cannot only help you, but if a user runs your program and it hangs on them, they can consult the log file as well as send you the log file for further study. Enought theory, time to get your hands dirty! |

