fix: set default settings for logging if null or empty
This commit is contained in:
parent
2e389b252c
commit
0ecb796d54
@ -236,11 +236,7 @@ public class SetupController(
|
|||||||
{
|
{
|
||||||
true => new LogSettings
|
true => new LogSettings
|
||||||
{
|
{
|
||||||
EnableLogToFile = true,
|
EnableLogToFile = true
|
||||||
LogFileName = "log-",
|
|
||||||
LogFilePath = OperatingSystem.IsWindows() || PathBuilder.IsDefaultPath ?
|
|
||||||
PathBuilder.Combine("logs") :
|
|
||||||
"/var/log/mirea"
|
|
||||||
},
|
},
|
||||||
false => new LogSettings
|
false => new LogSettings
|
||||||
{
|
{
|
||||||
@ -250,6 +246,17 @@ public class SetupController(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (settings.EnableLogToFile)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(settings.LogFileName))
|
||||||
|
settings.LogFileName = "log-";
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(settings.LogFilePath))
|
||||||
|
settings.LogFilePath = OperatingSystem.IsWindows() || PathBuilder.IsDefaultPath ?
|
||||||
|
PathBuilder.Combine("logs") :
|
||||||
|
"/var/log/mirea";
|
||||||
|
}
|
||||||
|
|
||||||
var general = GeneralConfig;
|
var general = GeneralConfig;
|
||||||
general.LogSettings = settings;
|
general.LogSettings = settings;
|
||||||
GeneralConfig = general;
|
GeneralConfig = general;
|
||||||
|
Loading…
Reference in New Issue
Block a user