fix: separate diagnostics gui log and accept ntfs prefix alias
This commit is contained in:
@@ -467,10 +467,18 @@ namespace C4IT.LIAM
|
||||
|
||||
private string GetRequiredCustomTag(string key)
|
||||
{
|
||||
if (!CustomTags.TryGetValue(key, out var value))
|
||||
throw new InvalidOperationException($"Missing NTFS custom tag '{key}'.");
|
||||
if (CustomTags.TryGetValue(key, out var value) && !string.IsNullOrWhiteSpace(value))
|
||||
return value;
|
||||
|
||||
if (string.Equals(key, "Filesystem_GroupPrefixTag", StringComparison.OrdinalIgnoreCase)
|
||||
&& CustomTags.TryGetValue("ADGroupPrefix", out value)
|
||||
&& !string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Missing NTFS custom tag '{key}'.");
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace LiamWorkflowDiagnostics
|
||||
private ProviderTestSession _session;
|
||||
private bool _isInitializingUi;
|
||||
private readonly object _diagnosticsLogSync = new object();
|
||||
private string _diagnosticsLogPath;
|
||||
private string _diagnosticsGuiLogPath;
|
||||
private string _diagnosticsStandardLogPath;
|
||||
private readonly string _settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LiamWorkflowDiagnostics.settings.json");
|
||||
|
||||
public MainWindow()
|
||||
@@ -67,10 +68,12 @@ namespace LiamWorkflowDiagnostics
|
||||
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
var logDirectory = Path.Combine(baseDir, "logs");
|
||||
Directory.CreateDirectory(logDirectory);
|
||||
_diagnosticsLogPath = Path.Combine(logDirectory, "LiamWorkflowDiagnostics.log");
|
||||
cLogManagerFile.CreateInstance(_diagnosticsLogPath);
|
||||
_diagnosticsStandardLogPath = Path.Combine(logDirectory, "LiamWorkflowDiagnostics.log");
|
||||
_diagnosticsGuiLogPath = Path.Combine(logDirectory, "LiamWorkflowDiagnostics.gui.log");
|
||||
cLogManagerFile.CreateInstance(_diagnosticsStandardLogPath);
|
||||
cLogManager.Instance.Level = LogLevels.Debug;
|
||||
AppendLog($"Logdatei: {_diagnosticsLogPath} (Level: Debug)");
|
||||
AppendLog($"GUI-Logdatei: {_diagnosticsGuiLogPath}");
|
||||
AppendLog($"Standard-Logdatei: {_diagnosticsStandardLogPath} (Level: Debug)");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -140,12 +143,12 @@ namespace LiamWorkflowDiagnostics
|
||||
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_diagnosticsLogPath))
|
||||
if (!string.IsNullOrWhiteSpace(_diagnosticsGuiLogPath))
|
||||
{
|
||||
var fileLine = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} [{level}] {message}{Environment.NewLine}";
|
||||
lock (_diagnosticsLogSync)
|
||||
{
|
||||
File.AppendAllText(_diagnosticsLogPath, fileLine, Encoding.UTF8);
|
||||
File.AppendAllText(_diagnosticsGuiLogPath, fileLine, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user