Skip to content

Instantly share code, notes, and snippets.

@ssukhpinder
Created July 24, 2020 16:36
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 ssukhpinder/298111524314f7d694804fcd0bdb1394 to your computer and use it in GitHub Desktop.
Save ssukhpinder/298111524314f7d694804fcd0bdb1394 to your computer and use it in GitHub Desktop.
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