add callback to print function