mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
parent
f55c19da6f
commit
69d75976c5
2 changed files with 10 additions and 10 deletions
|
@ -15,36 +15,37 @@ namespace Ombi.Controllers
|
|||
}
|
||||
|
||||
private ILogger Logger { get; }
|
||||
private const string Message = "Exception: {0} at {1}. Stacktrade {2}";
|
||||
|
||||
[HttpPost]
|
||||
public void Log([FromBody]UiLoggingModel l)
|
||||
public IActionResult Log([FromBody]UiLoggingModel l)
|
||||
{
|
||||
l.DateTime = DateTime.UtcNow;
|
||||
var exception = new Exception(l.Description, new Exception(l.StackTrace));
|
||||
|
||||
switch (l.Level)
|
||||
{
|
||||
case LogLevel.Trace:
|
||||
Logger.LogTrace(new EventId(l.Id), "Exception: {0} at {1}. Stacktrade {2}", l.Description, l.Location, l.StackTrace);
|
||||
Logger.LogTrace(new EventId(l.Id), Message, l.Description, l.Location, l.StackTrace);
|
||||
break;
|
||||
case LogLevel.Debug:
|
||||
Logger.LogDebug(new EventId(l.Id), "Exception: {0} at {1}. Stacktrade {2}", l.Description, l.Location, l.StackTrace);
|
||||
Logger.LogDebug(new EventId(l.Id), Message, l.Description, l.Location, l.StackTrace);
|
||||
break;
|
||||
case LogLevel.Information:
|
||||
Logger.LogInformation(new EventId(l.Id), "Exception: {0} at {1}. Stacktrade {2}", l.Description, l.Location, l.StackTrace);
|
||||
Logger.LogInformation(new EventId(l.Id), Message, l.Description, l.Location, l.StackTrace);
|
||||
break;
|
||||
case LogLevel.Warning:
|
||||
Logger.LogWarning(new EventId(l.Id), "Exception: {0} at {1}. Stacktrade {2}", l.Description, l.Location, l.StackTrace);
|
||||
Logger.LogWarning(new EventId(l.Id), Message, l.Description, l.Location, l.StackTrace);
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
Logger.LogError(new EventId(l.Id), "Exception: {0} at {1}. Stacktrade {2}", l.Description, l.Location, l.StackTrace);
|
||||
Logger.LogError(new EventId(l.Id), Message, l.Description, l.Location, l.StackTrace);
|
||||
break;
|
||||
case LogLevel.Critical:
|
||||
Logger.LogCritical(new EventId(l.Id), "Exception: {0} at {1}. Stacktrade {2}", l.Description, l.Location, l.StackTrace);
|
||||
Logger.LogCritical(new EventId(l.Id), Message, l.Description, l.Location, l.StackTrace);
|
||||
break;
|
||||
case LogLevel.None:
|
||||
break;
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"commandLineArgs": "server.urls=http://*:3579",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue