Allow ODIN_TEST_LOG_LEVEL override when -debug.

This commit is contained in:
Jeroen van Rijn
2024-08-14 16:29:51 +02:00
parent e810c3eace
commit f7234e2ed3
2 changed files with 11 additions and 12 deletions

View File

@@ -53,24 +53,20 @@ PROGRESS_WIDTH : int : #config(ODIN_TEST_PROGRESS_WIDTH, 24)
// If it is unspecified, it will be set to the system cycle counter at startup.
SHARED_RANDOM_SEED : u64 : #config(ODIN_TEST_RANDOM_SEED, 0)
// Set the lowest log level for this test run.
LOG_LEVEL : string : #config(ODIN_TEST_LOG_LEVEL, "info")
LOG_LEVEL_DEFAULT : string : "debug" when ODIN_DEBUG else "info"
LOG_LEVEL : string : #config(ODIN_TEST_LOG_LEVEL, LOG_LEVEL_DEFAULT)
// Show only the most necessary logging information.
USING_SHORT_LOGS : bool : #config(ODIN_TEST_SHORT_LOGS, false)
// Output a report of the tests to the given path.
JSON_REPORT : string : #config(ODIN_TEST_JSON_REPORT, "")
get_log_level :: #force_inline proc() -> runtime.Logger_Level {
when ODIN_DEBUG {
// Always use .Debug in `-debug` mode.
return .Debug
} else {
when LOG_LEVEL == "debug" { return .Debug } else
when LOG_LEVEL == "info" { return .Info } else
when LOG_LEVEL == "warning" { return .Warning } else
when LOG_LEVEL == "error" { return .Error } else
when LOG_LEVEL == "fatal" { return .Fatal } else {
#panic("Unknown `ODIN_TEST_LOG_LEVEL`: \"" + LOG_LEVEL + "\", possible levels are: \"debug\", \"info\", \"warning\", \"error\", or \"fatal\".")
}
when LOG_LEVEL == "debug" { return .Debug } else
when LOG_LEVEL == "info" { return .Info } else
when LOG_LEVEL == "warning" { return .Warning } else
when LOG_LEVEL == "error" { return .Error } else
when LOG_LEVEL == "fatal" { return .Fatal } else {
#panic("Unknown `ODIN_TEST_LOG_LEVEL`: \"" + LOG_LEVEL + "\", possible levels are: \"debug\", \"info\", \"warning\", \"error\", or \"fatal\".")
}
}

3
tests/.gitignore vendored
View File

@@ -13,6 +13,9 @@
# But remember to ignore executables with an extension.
*.exe
*.bin
*.bat
*.pdb
*.sh
# Ignore documentation-related files.
/documentation/verify/