mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Add secondary Trace callback
This commit is contained in:
@@ -113,7 +113,10 @@ namespace Microsoft.Iris.Debug
|
||||
if (IsCategoryEnabled(cat, levelFlag))
|
||||
{
|
||||
string content = string.Format(format, pars);
|
||||
System.Diagnostics.Debug.WriteLine(BuildLine(content));
|
||||
var line = BuildLine(content);
|
||||
|
||||
System.Diagnostics.Debug.WriteLine(line);
|
||||
TraceSettings.Current.FireWriteCallbacks(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Microsoft.Iris.Debug
|
||||
public class TraceSettings
|
||||
{
|
||||
private static TraceSettings s_instance;
|
||||
private Dictionary<TraceCategory, byte> CategoryLevels = new Dictionary<TraceCategory, byte>();
|
||||
private Dictionary<TraceCategory, byte> CategoryLevels = new();
|
||||
private string s_debugTraceFile;
|
||||
|
||||
public TraceSettings()
|
||||
@@ -90,5 +90,9 @@ namespace Microsoft.Iris.Debug
|
||||
public bool DebugTraceToFile => !string.IsNullOrEmpty(s_debugTraceFile);
|
||||
|
||||
public string DebugTraceFile => s_debugTraceFile;
|
||||
|
||||
public event Action<string> OnWriteLine;
|
||||
|
||||
internal void FireWriteCallbacks(string line) => OnWriteLine?.Invoke(line);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user