How to listen to console messages in new firefox quantum?

How to write an extension which listens to console messages? The support was there in old MDN API HUDService.getBrowserConsole().