Handle pandoc logging returning two unknown log levels by H0R5E · Pull Request #272 · JessicaTegner/pypandoc (original) (raw)
This is a follow up to #271, which deals with the case where pandoc produces more than one logging message with non-standard levels, followed by another log message. For example, the following pandoc output still produced a KeyError:
[WARN] This is some message on
two lines
[ERR] This is a second message.
[ERROR] This is a third message.
This PR updates the _classify_pandoc_logging function and the test_classify_pandoc_logging_invalid_level test to correctly handle this case.
I have also updated the level_map dictionary which converts the pandoc levels to python codes, so that it only contains levels formally used by pandoc.
Fixes #269