Replace print by logging