blob: a4d835a4a0c0742beea03dab0c5f753d1ec0d9bc [file] [log] [blame]
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -05001#ifndef AOS_TESTING_TEST_LOGGING_H_
2#define AOS_TESTING_TEST_LOGGING_H_
3
4namespace aos {
5namespace 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.
12void EnableTestLogging();
13
14// Redirect the messages enabled by EnableTestLogging() function to a file.
15// By default the messages are printed to standard output.
16void 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.
22void ForcePrintLogsDuringTests();
23
24} // namespace testing
25} // namespace aos
26
27#endif // AOS_TESTING_TEST_LOGGING_H_