kperun / SATPrakPDW

Interval Constraint Propagation strategy implementation for SMTRAT
MIT License
2 stars 0 forks source link

Improve Logging by using Log-Levels #41

Closed DavidWz closed 7 years ago

DavidWz commented 7 years ago

Create a new variable in settings called LOG_LEVEL which is: LOG_LEVEL = 0 in ICPPDWSettingsProduction LOG_LEVEL = 1 in ICPPDWSettingsDebug

A log level of 0 means no debug output, 1 means just basic debug output, and higher numbers mean more detailed debug output.

To this end, create a new log function in ICPUtil with the signature: void ICPUtil::log(int logLevel, ostream& stream)

Which compares the given logLevel with the settings LOG_LEVEL and only outputs the stream via cout if the log level is higher or equal than the given one. Replace all calls to SMTRAT_LOG with calls to this utility function with logLevel 1.

Also, revert the changes to the smt solver (i.e. put the define back in). Then, (for yourself), make the project again with logging disabled.

kperun commented 7 years ago

@DavidWz this issue has been solved, although by a different approach. We utilize a define in our settings header which can be used to turn on debug output. I think it is a better approach since we often use loops to only print out debug stuff. Encapsulated in defines, these loops are avoided if no debug is required. If we would use a log function, this loop would be invoked even if the called log function does not generate any output.