Use logging instead of printing to stdout