add a flag for logging, defaults to false