-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zonemaster::CLI: don’t lose early log messages
Adding fake delegation by means of the --ns command-line option can sometimes elicit early Zonemaster::Engine log messages that are lost because the translator isn’t properly initialized at this stage. For reasons that I do not understand fully yet, this situation causes a condition where the zonemaster-cli script displays no message at all, even though it should. As a workaround for this problem, we set the callback to Zonemaster::Engine::Logger twice. First, we set it to a closure that simply appends them to a queue of yet-to-be-printed messages. Right after the translator is initialized, we print the header and messages stored by the first callback before switching the callback to the function we actually wanted to use, which prints the messages on the terminal. A brief test shows no unintended side-effects with other output formats such as JSON. But the run() method in Zonemaster::CLI is long and has a high cyclomatic complexity, which doesn’t really help with testing!
- Loading branch information
1 parent
f99cf82
commit c3b90b7
Showing
1 changed file
with
77 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters