refoctoring for logging