first commit
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Landmark.OLA.Models;
|
||||
using Serilog;
|
||||
|
||||
namespace Landmark.OLA.Application.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class LoggingController : ControllerBase
|
||||
{
|
||||
public LoggingController()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use to send something to the logger from the client
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Logs a message from a client.
|
||||
/// Cookies: None required or set.
|
||||
/// Security: None set or required [yet]. It may be best to require a token here, but then we'll miss startup errors.
|
||||
/// </remarks>
|
||||
// Post: api/Logging/Error
|
||||
[HttpPost("Error")]
|
||||
[ProducesResponseType(200)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(403)]
|
||||
[ProducesResponseType(500)]
|
||||
public IActionResult Post([FromBody] ClientError error)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Error(error.Message, error.StackTrace);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e.Message);
|
||||
return StatusCode((int) System.Net.HttpStatusCode.InternalServerError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user