feature: Allow redirecting debugger logs to log file

- enhacement for logging debug messages to file

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2022-11-24 14:52:53 +00:00
committed by Compute-Runtime-Automation
parent c52f966fdf
commit 734a9fb952
6 changed files with 125 additions and 7 deletions

View File

@@ -395,6 +395,24 @@ TEST(FileLogger, whenFullyEnabledThenAllDebugFunctionalityIsAvailableAtCompileTi
static_assert(true == fileLogger.enabled(), "");
}
TEST(FileLogger, givenEnabledLogWhenLogDebugStringCalledThenStringIsWrittenToFile) {
std::string testFile = "testfile";
DebugVariables flags;
FullyEnabledFileLogger fileLogger(testFile, flags);
fileLogger.logDebugString(true, "test log");
EXPECT_EQ(std::string("test log"), fileLogger.getFileString(testFile));
}
TEST(FileLogger, givenDisabledLogWhenLogDebugStringCalledThenStringIsNotWrittenToFile) {
std::string testFile = "testfile";
DebugVariables flags;
FullyEnabledFileLogger fileLogger(testFile, flags);
fileLogger.logDebugString(false, "test log");
EXPECT_EQ(0u, fileLogger.getFileString(testFile).size());
}
TEST(AllocationTypeLogging, givenGraphicsAllocationTypeWhenConvertingToStringThenCorrectStringIsReturned) {
std::string testFile = "testfile";
DebugVariables flags;