refactor runtime toggling of the log level

* change argument name
* make toggle_log_level private
* simplify argument handling
* refactor and adjust tests