Pretty printing with position logging