Defensive logging on ASP.NET Core