added logs to the diagnose

This commit is contained in:
mxritzdev
2025-05-13 14:26:29 +02:00
parent ba736d2b19
commit 49848db96f

View File

@@ -11,11 +11,13 @@ public class CoreDiagnoseProvider : IDiagnoseProvider
{ {
private readonly AppConfiguration Config; private readonly AppConfiguration Config;
public CoreDiagnoseProvider(AppConfiguration config)
{
Config = config;
}
public DiagnoseEntry[] GetFiles() public DiagnoseEntry[] GetFiles()
{ {
// TODO:
// - read logs out from file for the diagnose below
return return
[ [
new DiagnoseDirectory() new DiagnoseDirectory()
@@ -26,7 +28,15 @@ public class CoreDiagnoseProvider : IDiagnoseProvider
new DiagnoseFile() new DiagnoseFile()
{ {
Name = "logs.txt", Name = "logs.txt",
GetContent = () => Encoding.UTF8.GetBytes("placeholder") GetContent = () =>
{
var logs = File.ReadAllText(PathBuilder.File("storage", "logs", "latest.log"));
if (string.IsNullOrEmpty(logs))
return Encoding.UTF8.GetBytes("Could not get the latest logs.");
return Encoding.UTF8.GetBytes(logs);
}
}, },
new DiagnoseFile() new DiagnoseFile()