@@ -13,7 +13,6 @@ function test_logLevelOptions() {
1313 test::title " ✅ Logging level through an environment variable"
1414 test::exec VALET_LOG_LEVEL=success " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" self mock1 logging-level
1515
16-
1716 test::title " ✅ Logging level with --log-level option"
1817 test::exec " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" --log-level warning self mock1 logging-level
1918
@@ -31,34 +30,30 @@ function test_logLevelOptions() {
3130 test::title " ✅ Logging level with --verbose option"
3231 test::exec " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" -v self mock1 logging-level
3332
34-
3533 test::title " ✅ Logging level with DEBUG set (also activates profiling)"
3634 test::exec DEBUG=1 " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" self mock1 logging-level
3735
3836 unset -f test::scrubOutput
3937}
4038
41-
4239function test_logDisplayOptions() {
4340 test::title " ✅ Testing that we can change the log display options"
4441 export VALET_CONFIG_LOG_PATTERN=' <level>_<message>'
4542 test::exec VALET_CONFIG_LOG_COLUMNS=40 VALET_CONFIG_ENABLE_COLORS=true VALET_CONFIG_ENABLE_NERDFONT_ICONS=true VALET_CONFIG_LOG_DISABLE_WRAP=false VALET_CONFIG_LOG_DISABLE_HIGHLIGHT=false " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" self mock1 logging-level
4643 export VALET_CONFIG_LOG_PATTERN=" <level> <message>"
4744}
4845
49-
5046function test_logOutputOptions() {
5147 fs::createTempDirectory
5248 local logDir=" ${REPLY} "
5349
5450 test::title " ✅ Testing that we can output the logs to a directory additionally to console"
5551 test::exec VALET_CONFIG_LOG_TO_DIRECTORY=" ${logDir} " " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" self mock1 logging-level
5652 # shellcheck disable=SC2317
57- function test::scrubOutput() { GLOBAL_TEST_OUTPUT_CONTENT=" ${GLOBAL_TEST_OUTPUT_CONTENT// ????-??-??T??-??-??+????--PID_??????.log/ 2025-02-12T21-57-29+0000.log} " ; }
53+ function test::scrubOutput() { GLOBAL_TEST_OUTPUT_CONTENT=" ${GLOBAL_TEST_OUTPUT_CONTENT// ????-??-??T??-??-??+????--PID_??????.log/ 2025-02-12T21-57-29+0000.log} " ; }
5854 test::func fs::listFiles " ${logDir} "
5955 unset -f test::scrubOutput
6056
61-
6257 test::title " ✅ Testing that we can output the logs to a specific file name additionally to console"
6358 test::exec VALET_CONFIG_LOG_FILENAME_PATTERN=' logFile=test.log' VALET_CONFIG_LOG_TO_DIRECTORY=" true" " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" self mock1 logging-level
6459 core::getUserStateDirectory
@@ -71,7 +66,8 @@ function test_logOutputOptions() {
7166 test::title " ✅ Testing that we can output the logs to a specific numbered fd"
7267 local myFd
7368 exec {myFd}>> " ${logDir} /test3.log"
74- test::exec VALET_CONFIG_LOG_FD=" ${myFd} " " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" self mock1 logging-level
69+ test::prompt export VALET_CONFIG_LOG_FD=11
70+ VALET_CONFIG_LOG_FD=" ${myFd} " test::exec " ${GLOBAL_INSTALLATION_DIRECTORY} /valet" self mock1 logging-level
7571 test::exec fs::cat " ${logDir} /test3.log"
7672}
7773
0 commit comments