Brian Silverman | f5f8d8e | 2015-12-06 18:39:12 -0500 | [diff] [blame] | 1 | #ifndef AOS_TESTING_TEST_LOGGING_H_ |
| 2 | #define AOS_TESTING_TEST_LOGGING_H_ |
| 3 | |
| 4 | namespace aos { |
| 5 | namespace testing { |
| 6 | |
| 7 | // Enables the logging framework for use during a gtest test. |
| 8 | // It will print out all WARNING and above messages all of the time. It will |
| 9 | // also print out all log messages when a test fails. |
| 10 | // This function only needs to be called once in each process (after gtest is |
| 11 | // initialized), however it can be called more than that. |
| 12 | void EnableTestLogging(); |
| 13 | |
| 14 | // Redirect the messages enabled by EnableTestLogging() function to a file. |
| 15 | // By default the messages are printed to standard output. |
| 16 | void SetLogFileName(const char* filename); |
| 17 | |
| 18 | // Force the messages to be printed as they are handled by the logging |
| 19 | // framework. This can be useful for tests that hang where no messages would |
| 20 | // otherwise be printed. This is also useful for tests that do pass, but where |
| 21 | // we want to use graphing tools to verify what's happening. |
| 22 | void ForcePrintLogsDuringTests(); |
| 23 | |
| 24 | } // namespace testing |
| 25 | } // namespace aos |
| 26 | |
| 27 | #endif // AOS_TESTING_TEST_LOGGING_H_ |