Define a private logger。在函数执行各个阶段往logger里打日志。在logger with a settergetter method in the class. The configuration specifies the level that needs to be printed to the screen.
It is better to keep main simple. MFC and the like do not even use main directly, but implement program initialization through the constructor of the global object AppInstance. Specific logic is best encapsulated into classes.
There is no doubt that it is more appropriate to prompt the status in a specific function. The main function is the entry point of the program, and it is impossible to prompt the status of all functions and classes. For example, if a function calls another function, this nesting cannot be seen in the main function, so how can the status be prompted in the main function.
Define a private
logger
。在函数执行各个阶段往logger
里打日志。在logger
with a settergetter method in the class. The configuration specifies the level that needs to be printed to the screen.Since we want to prompt the function to complete, the function completion sign is normal return, so it is better to do it in main
It is better to keep main simple. MFC and the like do not even use main directly, but implement program initialization through the constructor of the global object AppInstance. Specific logic is best encapsulated into classes.
There is no doubt that it is more appropriate to prompt the status in a specific function. The main function is the entry point of the program, and it is impossible to prompt the status of all functions and classes. For example, if a function calls another function, this nesting cannot be seen in the main function, so how can the status be prompted in the main function.