Skip to content

Instantly share code, notes, and snippets.

@JoshuaCode
Created June 17, 2016 22:14
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 JoshuaCode/dfc0792acd9d43e5123ea8dd1576c4b7 to your computer and use it in GitHub Desktop.
Save JoshuaCode/dfc0792acd9d43e5123ea8dd1576c4b7 to your computer and use it in GitHub Desktop.
public class PersonController : Controller
{
private readonly ILogger _logger;
public PersonController(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.CreateLogger(GetType().FullName);
}
// GET: api/values
[HttpGet]
public IEnumerable<string> Get()
{
_logger.LogInformation("test message");
return new[] {"value1", "value2"};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment