test: add helpers to save and restore log levels