Skip to content

Commit f191d30

Browse files
committed
fix: Remove redundant dispatcherqueue from moduleprocess logging
1 parent 5bdf740 commit f191d30

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

VRCFaceTracking.ModuleProcess/ModuleProcessMain.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using VRCFaceTracking.Core.Params.Expressions;
88
using VRCFaceTracking.Core.Sandboxing;
99
using VRCFaceTracking.Core.Sandboxing.IPC;
10-
using Windows.System;
1110

1211
namespace VRCFaceTracking.ModuleProcess;
1312

@@ -106,7 +105,7 @@ static int VrcftMain(string modulePath, int serverPortNumber)
106105
// .AddSentry(o =>
107106
// o.Dsn =
108107
// "https://444b0799dd2b670efa85d866c8c12134@o4506152235237376.ingest.us.sentry.io/4506152246575104")
109-
.AddProvider(new ProxyLoggerProvider(DispatcherQueue.GetForCurrentThread()))
108+
.AddProvider(new ProxyLoggerProvider())
110109
)
111110
.BuildServiceProvider();
112111

@@ -118,7 +117,7 @@ static int VrcftMain(string modulePath, int serverPortNumber)
118117
Client = new VrcftSandboxClient(serverPortNumber, LoggerFactory);
119118

120119
// Bind the log function so that we can forward log messages to VRCFT's main process
121-
ProxyLogger.OnLog += (LogLevel level, string msg) =>
120+
ProxyLogger.OnLog += (level, msg) =>
122121
{
123122
var pkt = new EventLogPacket(level, msg);
124123
Client.SendData(pkt);

VRCFaceTracking.ModuleProcess/ProxyLogger.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.ObjectModel;
22
using Microsoft.Extensions.Logging;
3-
using Windows.System;
43

54
namespace VRCFaceTracking.ModuleProcess;
65

@@ -11,12 +10,10 @@ public class ProxyLogger : ILogger
1110
private readonly string _categoryName;
1211
// public static readonly ObservableCollection<string> AllLogs = new();
1312
public static OnLog OnLog;
14-
private static DispatcherQueue? _dispatcher;
1513

16-
public ProxyLogger(string categoryName, DispatcherQueue? queue)
14+
public ProxyLogger(string categoryName)
1715
{
1816
_categoryName = categoryName;
19-
_dispatcher = queue;
2017
}
2118

2219
public IDisposable BeginScope<TState>(TState state) where TState : notnull => default!;
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
using System.Collections.Concurrent;
22
using Microsoft.Extensions.Logging;
3-
using Windows.System;
43

54
namespace VRCFaceTracking.ModuleProcess;
65
public class ProxyLoggerProvider : ILoggerProvider
76
{
87
private readonly ConcurrentDictionary<string, ProxyLogger> _loggers =
98
new(StringComparer.OrdinalIgnoreCase);
109

11-
private readonly DispatcherQueue _dispatcher;
12-
13-
public ProxyLoggerProvider(DispatcherQueue dispatcher)
14-
{
15-
_dispatcher = dispatcher;
16-
}
17-
1810
public ILogger CreateLogger(string categoryName) =>
19-
_loggers.GetOrAdd(categoryName, name => new ProxyLogger(name, _dispatcher));
11+
_loggers.GetOrAdd(categoryName, name => new ProxyLogger(name));
2012

2113
public void Dispose() => _loggers.Clear();
2214
}

0 commit comments

Comments
 (0)