My code (that @rtibbles merged) for being more robust to any possible errors for UserLogs!