Created
July 24, 2020 16:36
-
-
Save ssukhpinder/298111524314f7d694804fcd0bdb1394 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Logging; | |
namespace FileLoggingNlog | |
{ | |
[Route("api/[controller]")] | |
[ApiController] | |
public class ValuesController : ControllerBase | |
{ | |
private readonly ILogger<ValuesController> _logger; | |
public ValuesController(ILogger<ValuesController> logger) | |
{ | |
_logger = logger; | |
} | |
[HttpGet] | |
[Route("get")] | |
public string GetUsers() | |
{ | |
int x = 0; | |
int y = 1; | |
int z = y / x; | |
_logger.LogInformation("Values returned from GET route"); | |
return "values"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment