-
Book Overview & Buying
-
Table Of Contents
Test-Driven Development with C++
By :
Filtering log messages lets us write code that includes calls to log information at important places within the code but then ignore some of those logging calls. Why would we go to all the trouble of adding code to do logging but then not do the logging?
For some events in the code such as an error that gets detected, it makes sense to always log that event. Other places might be equally important even if they are not errors. Usually, these are places in the code where something gets created or deleted. I’m not talking about creating or deleting an instance of a local variable. I mean something major, such as the creation of a new customer account, the completion of a quest in an adventure game, or the deletion of an old data file to free up space. All of these are good examples of important events that should probably always be logged.
Other events might help a developer understand what a program was doing right before it crashed. These log...