adds a logger
This commit is contained in:
parent
b3b7d08e71
commit
39bae2aaab
1 changed files with 7 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
|
|
||||||
|
|
@ -14,10 +15,13 @@ namespace Yavsc.Controllers
|
||||||
public class TagsApiController : Controller
|
public class TagsApiController : Controller
|
||||||
{
|
{
|
||||||
private ApplicationDbContext _context;
|
private ApplicationDbContext _context;
|
||||||
|
ILogger _logger;
|
||||||
|
|
||||||
public TagsApiController(ApplicationDbContext context)
|
public TagsApiController(ApplicationDbContext context,
|
||||||
|
ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_logger = loggerFactory.CreateLogger<TagsApiController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/TagsApi
|
// GET: api/TagsApi
|
||||||
|
|
@ -65,6 +69,7 @@ namespace Yavsc.Controllers
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_context.SaveChanges(User.GetUserId());
|
_context.SaveChanges(User.GetUserId());
|
||||||
|
_logger.LogInformation("Tag created");
|
||||||
}
|
}
|
||||||
catch (DbUpdateConcurrencyException)
|
catch (DbUpdateConcurrencyException)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue