Skip to content

Commit 54e9aa7

Browse files
committed
Implement test log on default route
#9
1 parent 13f159f commit 54e9aa7

File tree

1 file changed

+17
-27
lines changed

1 file changed

+17
-27
lines changed
Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using Microsoft.AspNetCore.Mvc;
3-
4+
using Microsoft.Extensions.Logging;
5+
46
namespace VTEX.SampleWebAPI.Controllers
57
{
68
[Route("api/[controller]")]
79
public class ValuesController : Controller
810
{
11+
readonly ILogger logger;
12+
13+
public ValuesController(ILoggerFactory loggerFactory)
14+
{
15+
logger = loggerFactory.CreateLogger<ValuesController>();
16+
}
17+
918
// GET api/values
1019
[HttpGet]
1120
public IEnumerable<string> Get()
1221
{
22+
logger.DefineVTEXLog(LogLevel.Critical,
23+
"Values Controller",
24+
"api/values",
25+
string.Empty,
26+
new NotImplementedException(),
27+
new Tuple<string, string>("method", "GET"));
1328
return new string[] { "value1", "value2" };
1429
}
15-
16-
// GET api/values/5
17-
[HttpGet("{id}")]
18-
public string Get(int id)
19-
{
20-
return "value";
21-
}
22-
23-
// POST api/values
24-
[HttpPost]
25-
public void Post([FromBody]string value)
26-
{
27-
}
28-
29-
// PUT api/values/5
30-
[HttpPut("{id}")]
31-
public void Put(int id, [FromBody]string value)
32-
{
33-
}
34-
35-
// DELETE api/values/5
36-
[HttpDelete("{id}")]
37-
public void Delete(int id)
38-
{
39-
}
4030
}
4131
}

0 commit comments

Comments
 (0)