Added diagnostic helper for logging