Created
May 11, 2021 19:45
-
-
Save manoj-choudhari-git/dfffcf9603f1d7edf18d1bc9ba157b72 to your computer and use it in GitHub Desktop.
.NET Core Web Application - Logging Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeController : Controller | |
{ | |
private readonly ILogger<HomeController> _logger; | |
public HomeController(ILogger<HomeController> logger) | |
{ | |
_logger = logger; | |
} | |
public IActionResult Index() | |
{ | |
_logger.LogInformation("Info Log"); | |
_logger.LogWarning("Warning Log"); | |
_logger.LogError("Error Log"); | |
_logger.LogCritical("Critical Log"); | |
return View(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment