diff --git a/ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/ExternalFormatterEndPoint.cs b/ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/ExternalFormatterEndPoint.cs index 917cbf7eff..2795c6d573 100644 --- a/ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/ExternalFormatterEndPoint.cs +++ b/ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/ExternalFormatterEndPoint.cs @@ -3,36 +3,29 @@ using JetBrains.Diagnostics; using JetBrains.Lifetimes; using JetBrains.Platform.RdFramework.ExternalProcess; +using JetBrains.Platform.RdFramework.ExternalProcess.Util; using JetBrains.Rd.Impl; using JetBrains.Rider.FSharp.ExternalFormatter.Client; using JetBrains.Util; -using JetBrains.Util.Logging; using JetBrains.Rd.Tasks; namespace FSharp.ExternalFormatter.Host { internal class ExternalFormatterEndPoint : ProtocolEndPoint { - private readonly ExternalCodeFormatter myCodeFormatter; + private readonly FantomasCodeFormatter myCodeFormatter; protected override string ProtocolName => "External Formatter Host"; public ExternalFormatterEndPoint() : base(FantomasProtocolConstants.PARENT_PROCESS_PID_ENV_VARIABLE) { - myCodeFormatter = new ExternalCodeFormatter(); + myCodeFormatter = new FantomasCodeFormatter(); } protected override RdSimpleDispatcher InitDispatcher(Lifetime lifetime, ILogger logger) => new RdSimpleDispatcher(lifetime, logger); - protected override void InitLogger(Lifetime lifetime, string path) - { - LogManager.Instance.SetConfig(new XmlLogConfigModel()); - var logPath = FileSystemPath.TryParse(path); - if (logPath.IsNullOrEmpty()) return; - - var logEventListener = new FileLogEventListener(logPath); - LogManager.Instance.AddOmnipresentLogger(lifetime, logEventListener, LoggingLevel.TRACE); - } + protected override void InitLogger(Lifetime lifetime, string path) => + ProtocolEndPointUtil.InitLogger(path, lifetime, LoggingLevel.TRACE); protected override RdFSharpExternalFormatterModel InitModel(Lifetime lifetime, JetBrains.Rd.Impl.Protocol protocol) { diff --git a/ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/CodeFormatterProvider.cs b/ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/FantomasCodeFormatter.cs similarity index 98% rename from ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/CodeFormatterProvider.cs rename to ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/FantomasCodeFormatter.cs index 59740fd5a7..92f0cb55f6 100644 --- a/ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/CodeFormatterProvider.cs +++ b/ReSharper.FSharp/src/FSharp.ExternalFormatter.Host/src/FantomasCodeFormatter.cs @@ -8,7 +8,7 @@ namespace FSharp.ExternalFormatter.Host { - internal class ExternalCodeFormatter + internal class FantomasCodeFormatter { private readonly FSharpChecker myChecker = FSharpChecker.Create(null, null, null, null, null, null, null, null, null, null); diff --git a/ReSharper.FSharp/src/FSharp.TypeProviders.Host/src/TypeProvidersEndPoint.cs b/ReSharper.FSharp/src/FSharp.TypeProviders.Host/src/TypeProvidersEndPoint.cs index 1d16c59472..9bb640d78e 100644 --- a/ReSharper.FSharp/src/FSharp.TypeProviders.Host/src/TypeProvidersEndPoint.cs +++ b/ReSharper.FSharp/src/FSharp.TypeProviders.Host/src/TypeProvidersEndPoint.cs @@ -2,12 +2,12 @@ using JetBrains.Diagnostics; using JetBrains.Lifetimes; using JetBrains.Platform.RdFramework.ExternalProcess; +using JetBrains.Platform.RdFramework.ExternalProcess.Util; using JetBrains.Rd.Impl; using JetBrains.ReSharper.Plugins.FSharp.TypeProviders.Host.Hosts; using JetBrains.ReSharper.Plugins.FSharp.TypeProviders.Protocol; using JetBrains.Rider.FSharp.TypeProviders.Protocol.Server; using JetBrains.Util; -using JetBrains.Util.Logging; namespace JetBrains.ReSharper.Plugins.FSharp.TypeProviders.Host { @@ -30,12 +30,7 @@ protected override RdSimpleDispatcher InitDispatcher(Lifetime lifetime, ILogger protected override void InitLogger(Lifetime lifetime, string path) { - LogManager.Instance.SetConfig(new XmlLogConfigModel()); - var logPath = FileSystemPath.TryParse(path); - if (logPath.IsNullOrEmpty()) return; - - var logEventListener = new FileLogEventListener(logPath); - LogManager.Instance.AddOmnipresentLogger(lifetime, logEventListener, LoggingLevel.TRACE); + ProtocolEndPointUtil.InitLogger(path, lifetime, LoggingLevel.TRACE); Logger.Log(LoggingLevel.INFO, $"Process Runtime: {RuntimeInformation.FrameworkDescription}"); }