Skip to content

Instantly share code, notes, and snippets.

@alistairjevans
Created September 7, 2019 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alistairjevans/27337c1dd7956a55afae1cbfc8e3f87a to your computer and use it in GitHub Desktop.
Save alistairjevans/27337c1dd7956a55afae1cbfc8e3f87a to your computer and use it in GitHub Desktop.
Index page logging
public class HomeController : Controller
{
public ILogger<HomeController> Logger { get; }
public HomeController(ILogger<HomeController> logger)
{
Logger = logger;
}
public IActionResult Index()
{
Logger.LogInformation("User loaded the home page");
return View();
}
// and the rest..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment