Skip to content

Commit 11a1821

Browse files
committed
docs: update docs/configuration.md
1 parent c475f84 commit 11a1821

5 files changed

Lines changed: 18 additions & 20 deletions

File tree

docs/configuration.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,17 +227,16 @@ log "error" "an" "error" "message"
227227
log "warning" "different log level messages!"
228228
```
229229
```bash [Output: out.log]
230-
2024-10-03 21:27:23 [INFO] (main): I am tracing something... #tests/sample.sh:42
231-
2024-10-03 21:27:23 [ERROR] (main): an error message #tests/sample.sh:43
232-
2024-10-03 21:27:23 [WARNING] (main): different log level messages! #tests/sample.sh:44
233-
2024-10-03 21:27:23 [INTERNAL] (main::exec_tests): debug exec_tests filter:none files:sample.sh #src/main.sh:5
230+
2024-10-03 21:27:23 [INFO]: I am tracing something... #tests/sample.sh:11
231+
2024-10-03 21:27:23 [ERROR]: an error message #tests/sample.sh:27
232+
2024-10-03 21:27:24 [WARNING]: different log level messages! #tests/sample.sh:21
234233
```
235234
:::
236235
When enabled, the selected log file path is printed in the header so you can
237236
quickly `tail -f` it while the tests run.
238-
All internal messages emitted by bashunit are prefixed with `[INTERNAL]`.
239237

240-
You can toggle internal messages with `BASHUNIT_INTERNAL_LOG=true|false`.
238+
> All internal messages emitted by bashunit are prefixed with `[INTERNAL]`.
239+
> You can toggle internal messages with `BASHUNIT_INTERNAL_LOG=true|false`.
241240
242241
## Verbose
243242

docs/globals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ You can use this list of global functions that exists to primarily to improve yo
55

66
## log
77

8-
Write into the `BASHUNIT_DEV_LOG` a log message. The log line records the calling function name, source file and line number for easier debugging.
9-
Internal messages from bashunit include the `[INTERNAL]` prefix so you can easily spot them.
8+
Write into the `BASHUNIT_DEV_LOG` a log message. The log line records the source file and line number for easier debugging.
109

1110
> See: [Dev log](/configuration#dev-log)
1211
@@ -18,6 +17,7 @@ log "warning" "hello" "world"
1817
log "critical" "hello" "world"
1918
log "error" "hello" "world"
2019
```
20+
Internal messages from bashunit include the `[INTERNAL]` prefix so you can easily spot them. You can enable them with `BASHUNIT_INTERNAL_LOG=true|false`.
2121

2222
## current_dir
2323

src/main.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ function main::exec_tests() {
1010
done < <(helper::load_test_files "$filter" "${files[@]}")
1111

1212
internal_log "exec_tests" "filter:$filter" "files:${test_files[*]}"
13-
internal_log "Start tests" "files:${test_files[*]}"
1413

1514
if [[ ${#test_files[@]} -eq 0 || -z "${test_files[0]}" ]]; then
1615
printf "%sError: At least one file path is required.%s\n" "${_COLOR_FAILED}" "${_COLOR_DEFAULT}"

src/state.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function state::print_line() {
208208
incomplete) char="${_COLOR_INCOMPLETE}I${_COLOR_DEFAULT}" ;;
209209
snapshot) char="${_COLOR_SNAPSHOT}N${_COLOR_DEFAULT}" ;;
210210
error) char="${_COLOR_FAILED}E${_COLOR_DEFAULT}" ;;
211-
*) char="?" && internal_log "warning" "unknown test type '$type'" ;;
211+
*) char="?" && log "warning" "unknown test type '$type'" ;;
212212
esac
213213

214214
if parallel::is_enabled; then

tests/unit/globals_test.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ function set_up() {
1010
export BASHUNIT_DEV_LOG
1111
}
1212

13-
#function tear_down() {
14-
# rm "$BASHUNIT_DEV_LOG"
15-
#}
13+
function tear_down() {
14+
rm "$BASHUNIT_DEV_LOG"
15+
}
1616

1717
function test_globals_current_dir() {
1818
assert_same "tests/unit" "$(current_dir)"
@@ -75,43 +75,43 @@ function test_globals_temp_dir() {
7575
function test_globals_log_level_error() {
7676
log "error" "hello," "error"
7777

78-
assert_file_contains "$BASHUNIT_DEV_LOG" "[ERROR] (test_globals_log_level_error): hello, error"
78+
assert_file_contains "$BASHUNIT_DEV_LOG" "[ERROR]: hello, error"
7979
}
8080

8181
function test_globals_log_level_warning() {
8282
log "warning" "hello," "warning"
8383

84-
assert_file_contains "$BASHUNIT_DEV_LOG" "[WARNING] (test_globals_log_level_warning): hello, warning"
84+
assert_file_contains "$BASHUNIT_DEV_LOG" "[WARNING]: hello, warning"
8585
}
8686

8787
function test_globals_log_level_debug() {
8888
log "debug" "hello," "debug"
8989

90-
assert_file_contains "$BASHUNIT_DEV_LOG" "[DEBUG] (test_globals_log_level_debug): hello, debug"
90+
assert_file_contains "$BASHUNIT_DEV_LOG" "[DEBUG]: hello, debug"
9191
}
9292

9393
function test_globals_log_level_critical() {
9494
log "critical" "hello," "critical"
9595

96-
assert_file_contains "$BASHUNIT_DEV_LOG" "[CRITICAL] (test_globals_log_level_critical): hello, critical"
96+
assert_file_contains "$BASHUNIT_DEV_LOG" "[CRITICAL]: hello, critical"
9797
}
9898

9999
function test_globals_log_level_info() {
100100
log "info" "hello," "info"
101101

102-
assert_file_contains "$BASHUNIT_DEV_LOG" "[INFO] (test_globals_log_level_info): hello, info"
102+
assert_file_contains "$BASHUNIT_DEV_LOG" "[INFO]: hello, info"
103103
}
104104

105105
function test_globals_log_level_default() {
106106
log "hello," "info"
107107

108-
assert_file_contains "$BASHUNIT_DEV_LOG" "[INFO] (test_globals_log_level_default): hello, info"
108+
assert_file_contains "$BASHUNIT_DEV_LOG" "[INFO]: hello, info"
109109
}
110110

111111
function test_internal_log_prefix() {
112112
export BASHUNIT_INTERNAL_LOG=true
113113
internal_log "info" "some" "message"
114114
export BASHUNIT_INTERNAL_LOG=false
115115

116-
assert_file_contains "$BASHUNIT_DEV_LOG" "[INTERNAL] (test_internal_log_prefix): info some message"
116+
assert_file_contains "$BASHUNIT_DEV_LOG" "[INTERNAL]: info some message"
117117
}

0 commit comments

Comments
 (0)