Skip to content

Commit

Permalink
hide yield msgs at log level 0 (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwes authored May 9, 2022
1 parent 56e9147 commit 83f2829
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gutconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"should_maximize":false,
"should_exit":true,
"ignore_pause":true,
"log_level":3,
"log_level":0,
"opacity":100,
"double_strategy":"partial",
"include_subdirs":true,
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).


# 7.X.X

#### Misc
* Yield messages are now disabled on log level 0.

# 7.3.0

## Features
Expand Down
8 changes: 4 additions & 4 deletions addons/gut/gut.gd
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func _wait_for_done(result):
# callback method sets waiting to false.
result.connect(COMPLETED, self, '_on_test_script_yield_completed')
if(!_was_yield_method_called):
_lgr.log('-- Yield detected, waiting --', _lgr.fmts.yellow)
_lgr.yield_msg('-- Yield detected, waiting --')

_was_yield_method_called = false
_waiting = true
Expand Down Expand Up @@ -1358,7 +1358,7 @@ func set_yield_time(time, text=''):
msg += ' --'
else:
msg += ': ' + text + ' --'
_lgr.log(msg, _lgr.fmts.yellow)
_lgr.yield_msg(msg)
_was_yield_method_called = true
return self

Expand All @@ -1375,7 +1375,7 @@ func set_yield_frames(frames, text=''):
msg += ' --'
else:
msg += ': ' + text + ' --'
_lgr.log(msg, _lgr.fmts.yellow)
_lgr.yield_msg(msg)

_was_yield_method_called = true
_yield_frames = max(frames + 1, 1)
Expand All @@ -1393,7 +1393,7 @@ func set_yield_signal_or_time(obj, signal_name, max_wait, text=''):
_yield_timer.set_wait_time(max_wait)
_yield_timer.start()
_was_yield_method_called = true
_lgr.log(str('-- Yielding to signal "', signal_name, '" or for ', max_wait, ' seconds -- ', text), _lgr.fmts.yellow)
_lgr.yield_msg(str('-- Yielding to signal "', signal_name, '" or for ', max_wait, ' seconds -- ', text))
return self

# ------------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions addons/gut/logger.gd
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,19 @@ func _end_yield_gui():
lbl.visible = false
lbl.set_text('')

# This is used for displaying the "yield detected" and "yielding to" messages.
func yield_msg(text):
if(_type_data.warn.enabled):
self.log(text, fmts.yellow)

# This is used for the animated "waiting" message
func yield_text(text):
_yield_text_terminal(text)
_yield_text_gui(text)
_last_yield_text = text
_yield_calls += 1

# This is used for the animated "waiting" message
func end_yield():
if(_yield_calls == 0):
return
Expand Down

0 comments on commit 83f2829

Please sign in to comment.