@@ -20,8 +20,8 @@ export _GO_LOG_TIMESTAMP_FORMAT=
2020#
2121# Arguments:
2222# ...: Lines comprising the `./go` script
23- create_log_script (){
24- create_test_go_script \
23+ @go. create_log_script (){
24+ @go. create_test_go_script \
2525 " . \"\$ _GO_USE_MODULES\" 'log'" \
2626 ' if [[ -n "$TEST_LOG_FILE" ]]; then' \
2727 ' @go.log_add_output_file "$TEST_LOG_FILE"' \
@@ -31,17 +31,17 @@ create_log_script(){
3131
3232# Creates and executes a `./go` script that imports the `log` module
3333#
34- # Globals and arguments are identical to `create_log_script`.
35- run_log_script () {
36- create_log_script " $@ "
34+ # Globals and arguments are identical to `@go. create_log_script`.
35+ @go. run_log_script () {
36+ @go. create_log_script " $@ "
3737 run " $TEST_GO_SCRIPT "
3838}
3939
4040# Format a `log` module log level label
4141#
4242# Arguments:
4343# label: Log level label to format
44- format_log_label () {
44+ @go. format_log_label () {
4545 local label=" $1 "
4646
4747 . " $_GO_USE_MODULES " ' log'
@@ -65,6 +65,10 @@ format_log_label() {
6565# plaintext label or a label formatted with `format_log_label`. Any unknown
6666# labels will be parsed as "a single string without a log label prefix".
6767#
68+ # If the log label contains format codes, a formatting reset code will
69+ # automatically get appended to the expected log message, so there's no need to
70+ # add it explicitly.
71+ #
6872# If you aren't looking for exact log output, consider using one of the standard
6973# assertions from `_GO_CORE_DIR/lib/bats/assertions` instead.
7074#
@@ -73,7 +77,7 @@ format_log_label() {
7377#
7478# Arguments:
7579# ...: Lines of expected log output
76- assert_log_equals () {
80+ @go. assert_log_equals () {
7781 set " $BATS_ASSERTION_DISABLE_SHELL_OPTIONS "
7882 local __log_level_label
7983 local expected=()
@@ -83,7 +87,7 @@ assert_log_equals() {
8387 _@go.log_init
8488
8589 for (( i= 0 ; $# != 0 ; ++ i)) ; do
86- if __parse_log_level_label " $1 " ; then
90+ if __@go.parse_log_level_label " $1 " ; then
8791 expected+=(" $__log_level_label $2 " )
8892
8993 if [[ " ${__log_level_label: 0: 1} " == $' \e ' ]]; then
@@ -111,30 +115,30 @@ assert_log_equals() {
111115# Validates that a file matches the expected `@go.log` output
112116#
113117# Aside from the first file path argument, the remaining arguments and semantics
114- # are exactly the same as `assert_log_equals`.
118+ # are exactly the same as `@go. assert_log_equals`.
115119#
116120# In cases where `@go.log_add_output_file` is used to add a `TEST_LOG_FILE` to
117121# all levels, and all test output comes from `@go.log`, this may be invoked
118- # following `assert_log_equals` like so to ensure the log file output matches
119- # standard output and standard error:
122+ # following `@go. assert_log_equals` like so to ensure the log file output
123+ # matches standard output and standard error:
120124#
121- # assert_log_file_equals "$TEST_LOG_FILE" "${lines[@]}"
125+ # @go. assert_log_file_equals "$TEST_LOG_FILE" "${lines[@]}"
122126#
123127# If you aren't looking for exact log output, consider using one of the standard
124128# assertions from `_GO_CORE_DIR/lib/bats/assertions` instead.
125129#
126130# Arguments:
127131# log_file: Path to the log file to validate
128132# ...: Lines of expected log output
129- assert_log_file_equals () {
133+ @go. assert_log_file_equals () {
130134 set " $BATS_ASSERTION_DISABLE_SHELL_OPTIONS "
131135 local log_file=" $1 "
132136 shift
133137
134138 if ! set_bats_output_and_lines_from_file " $log_file " ; then
135139 return_from_bats_assertion ' 1'
136140 else
137- assert_log_equals " $@ "
141+ @go. assert_log_equals " $@ "
138142 return_from_bats_assertion " $? "
139143 fi
140144}
@@ -151,16 +155,16 @@ assert_log_file_equals() {
151155# LOG_COMMAND_STACK_TRACE_ITEMS:
152156# Stack trace lines from `@go.log_command` comprising the command logging
153157# mechanism
154- set_log_command_stack_trace_items () {
158+ @go. set_log_command_stack_trace_items () {
155159 if [[ " ${# LOG_COMMAND_STACK_TRACE_ITEMS[@]} " -eq ' 0' ]]; then
156160 export LOG_COMMAND_STACK_TRACE_ITEMS
157161 LOG_COMMAND_STACK_TRACE_ITEMS=(
158- " $( stack_trace_item " $_GO_CORE_DIR /lib/log" ' _@go.log_command_invoke ' \
159- ' "${__go_log_command_args[@]}" 2>&1' ) "
162+ " $( @go. stack_trace_item " $_GO_CORE_DIR /lib/log" \
163+ ' _@go.log_command_invoke ' ' "${__go_log_command_args[@]}" 2>&1' ) "
160164 # For some reason, with the process redirection at the end of the
161165 # `while` loop, the stack trace reports the opening line of the function
162166 # definition, not the actual `done < <(_@go.log_command_invoke)` line.
163- " $( stack_trace_item " $_GO_CORE_DIR /lib/log" ' @go.log_command' ) " )
167+ " $( @go. stack_trace_item " $_GO_CORE_DIR /lib/log" ' @go.log_command' ) " )
164168 fi
165169}
166170
@@ -180,7 +184,7 @@ set_log_command_stack_trace_items() {
180184# Returns:
181185# zero if `level_label` exists in `_GO_LOG_LEVELS`, nonzero otherwise
182186# __log_level_label: Assigned the padded version of `level_label` if valid
183- __parse_log_level_label () {
187+ __@go.parse_log_level_label () {
184188 local level_label=" $1 "
185189 local try_level
186190 local __go_log_level_index
0 commit comments