Added structured logging to file and Grafana Loki

This commit is contained in:
2023-03-09 00:12:07 -06:00
parent 52273a8d12
commit 0ad6e99a8f
4 changed files with 73 additions and 5 deletions

View File

@ -7,16 +7,38 @@
}
},
"Serilog": {
"MinimumLevel": "Information",
"MinimumLevel": "Information",
"Using": [
"Serilog.Sinks.Grafana.Loki"
],
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "Logs/log-.txt",
"rollingInterval": "Day"
"path": "Logs/log.json",
"rollingInterval": "Day",
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
},
{
"Name": "GrafanaLoki",
"Args": {
"uri": "https://loki.iwanaga.moe",
"labels": [
{
"key": "job",
"value": "YABA.API"
},
{
"key": "environment",
"value": "localhost"
}
],
"propertiesAsLabels": [ "job", "environment" ]
}
}
]
],
"Enrich": ["FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId"]
},
"WebClient": {
"Url": "https://localhost:3000"