blob: b7e89770c146d40d3ff462262e6b6add7e395cce [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
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -08004namespace aos::testing {
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -05005
6// Enables the logging framework for use during a gtest test.
7// It will print out all WARNING and above messages all of the time. It will
8// also print out all log messages when a test fails.
9// This function only needs to be called once in each process (after gtest is
10// initialized), however it can be called more than that.
11void EnableTestLogging();
12
13// Redirect the messages enabled by EnableTestLogging() function to a file.
14// By default the messages are printed to standard output.
Austin Schuh60e77942022-05-16 17:48:24 -070015void SetLogFileName(const char *filename);
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050016
17// Force the messages to be printed as they are handled by the logging
18// framework. This can be useful for tests that hang where no messages would
19// otherwise be printed. This is also useful for tests that do pass, but where
20// we want to use graphing tools to verify what's happening.
21void ForcePrintLogsDuringTests();
22
Stephan Pleinesd99b1ee2024-02-02 20:56:44 -080023} // namespace aos::testing
Brian Silvermanf5f8d8e2015-12-06 18:39:12 -050024
25#endif // AOS_TESTING_TEST_LOGGING_H_