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() { } /// /// Use to send something to the logger from the client /// /// /// 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. /// // 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); } } } }