diff --git a/src/SLCore.Listeners.UnitTests/Logging/LoggerListenerTests.cs b/src/SLCore.Listeners.UnitTests/Logging/LoggerListenerTests.cs index ee2db968e9..85fae0b1c5 100644 --- a/src/SLCore.Listeners.UnitTests/Logging/LoggerListenerTests.cs +++ b/src/SLCore.Listeners.UnitTests/Logging/LoggerListenerTests.cs @@ -28,16 +28,12 @@ namespace SonarLint.VisualStudio.SLCore.Listeners.UnitTests.Logging public class LoggerListenerTests { [TestMethod] - public void MefCtor_CheckIsExported() - { + public void MefCtor_CheckIsExported() => MefTestHelpers.CheckTypeCanBeImported(MefTestHelpers.CreateExport()); - } [TestMethod] - public void Mef_CheckIsSingleton() - { + public void Mef_CheckIsSingleton() => MefTestHelpers.CheckIsSingletonMefComponent(); - } [TestMethod] [DataRow(LogLevel.ERROR, false)] @@ -55,14 +51,96 @@ public void Log_LogInfoTraceAndDebugAsVerbose(LogLevel logLevel, bool verboseLog testSubject.Log(param); - if (verboseLogs) + logger.AssertOutputStringExists(verboseLogs ? "[DEBUG] [SLCore] some Message" : "[SLCore] some Message"); + } + + [TestMethod] + public void Ctor_AddsProperties() + { + var logger = Substitute.For(); + _ = new LoggerListener(logger); + + logger.Received(1).ForContext(SLCoreStrings.SLCoreName); + } + + [TestMethod] + public void Log_AddsArgumentProperties() + { + var customizedLogger = Substitute.For(); + var logger = Substitute.For(); + logger.ForContext(SLCoreStrings.SLCoreName).Returns(customizedLogger); + var testSubject = new LoggerListener(logger); + + testSubject.Log(new LogParams{configScopeId = "configScopeId1", loggerName = "loggerName1", threadName = "threadName1"}); + testSubject.Log(new LogParams{configScopeId = "configScopeId2", loggerName = "loggerName2", threadName = "threadName2"}); + + customizedLogger.Received(1).WriteLine(Arg.Is(ctx => ctx.VerboseContext.SequenceEqual(new []{"loggerName1", "configScopeId1", "threadName1"})), Arg.Any()); + customizedLogger.Received(1).WriteLine(Arg.Is(ctx => ctx.VerboseContext.SequenceEqual(new []{"loggerName2", "configScopeId2", "threadName2"})), Arg.Any()); + } + + [TestMethod] + public void Log_ProducesCorrectFullFormat() + { + var testLogger = new TestLogger(logVerbose:false); + var testSubject = new LoggerListener(testLogger); + + testSubject.Log(new LogParams { - logger.AssertOutputStringExists("[DEBUG] [SLCORE] some Message"); - } - else + loggerName = "loggerName", + configScopeId = "configScopeId", + threadName = "threadName", + message = "message", + stackTrace = """ + stack + trace + """ + }); + + testLogger.AssertOutputStrings("[SLCore] message"); + } + + [TestMethod] + public void Log_ProducesCorrectFullVerboseFormat() + { + var testLogger = new TestLogger(); + var testSubject = new LoggerListener(testLogger); + + testSubject.Log(new LogParams { - logger.AssertOutputStringExists("[SLCORE] some Message"); - } + loggerName = "loggerName", + configScopeId = "configScopeId", + threadName = "threadName", + message = "message", + stackTrace = """ + stack + trace + """ + }); + + testLogger.AssertOutputStrings( + "[SLCore] [loggerName > configScopeId > threadName] message", + """ + [DEBUG] [SLCore] [loggerName > configScopeId > threadName] stack + trace + """); + } + + [TestMethod] + public void Log_NullablePropertiesMissing_ProducesCorrectMessage() + { + var testLogger = new TestLogger(); + var testSubject = new LoggerListener(testLogger); + + testSubject.Log(new LogParams + { + loggerName = "loggerName", + configScopeId = null, + threadName = "threadName", + message = "message", + stackTrace = null + }); + + testLogger.AssertOutputStrings("[SLCore] [loggerName > threadName] message"); } } } diff --git a/src/SLCore.Listeners.UnitTests/Logging/LoggerSerializationTests.cs b/src/SLCore.Listeners.UnitTests/Logging/LoggerSerializationTests.cs index de462e9dfa..94ce02ee99 100644 --- a/src/SLCore.Listeners.UnitTests/Logging/LoggerSerializationTests.cs +++ b/src/SLCore.Listeners.UnitTests/Logging/LoggerSerializationTests.cs @@ -23,6 +23,7 @@ namespace SonarLint.VisualStudio.SLCore.Listeners.UnitTests.Logging { + [TestClass] public class LoggerSerializationTests { [TestMethod] @@ -56,5 +57,33 @@ public void DeSerializeLogParams_StringEnums(string level, LogLevel expectedLeve result.message.Should().Be("Some Message"); result.level.Should().Be(expectedLevel); } + + [TestMethod] + public void DeserializeExtraProperties() + { + const string serialzied = + """ + { + "level": "ERROR", + "message": "Unable to load plugin ...\\storageRoot\\68747470733a2f2f736f6e6172636c6f75642e696f2f6f7267616e697a6174696f6e732f64756e63616e702d736f6e61722d74657374\\plugins\\sonarlint-license-plugin-8.0.0.58632-all.jar", + "configScopeId": "SLVS_Bound_VS2019", + "threadName": "SonarLint Server RPC request executor", + "loggerName": "sonarlint", + "stackTrace": "java.lang.IllegalStateException: Error while reading plugin manifest from jar: ...\\storageRoot\\68747470733a2f2f736f6e6172636c6f75642e696f2f6f7267616e697a6174696f6e732f64756e63616e702d736f6e61722d74657374\\plugins\\sonarlint-license-plugin-8.0.0.58632-all.jar\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.loading.SonarPluginManifest.fromJar(SonarPluginManifest.java:105)\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.loading.PluginInfo.create(PluginInfo.java:221)\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.loading.SonarPluginRequirementsChecker.checkRequirements(SonarPluginRequirementsChecker.java:64)\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.PluginsLoader.load(PluginsLoader.java:65)\r\n\tat org.sonarsource.sonarlint.core.plugin.PluginsService.loadPlugins(PluginsService.java:189)\r\n\tat org.sonarsource.sonarlint.core.plugin.PluginsService.loadPlugins(PluginsService.java:147)\r\n\tat org.sonarsource.sonarlint.core.plugin.PluginsService.getPlugins(PluginsService.java:136)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisEngineCache.lambda$getOrCreateConnectedEngine$2(AnalysisEngineCache.java:97)\r\n\tat java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisEngineCache.getOrCreateConnectedEngine(AnalysisEngineCache.java:96)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisEngineCache.lambda$getOrCreateAnalysisEngine$1(AnalysisEngineCache.java:91)\r\n\tat java.base/java.util.Optional.map(Unknown Source)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisEngineCache.getOrCreateAnalysisEngine(AnalysisEngineCache.java:91)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisService.analyze(AnalysisService.java:647)\r\n\tat org.sonarsource.sonarlint.core.rpc.impl.AnalysisRpcServiceDelegate.lambda$analyzeFilesAndTrack$8(AnalysisRpcServiceDelegate.java:143)\r\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)\r\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)\r\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)\r\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)\r\n\tat java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\r\n\tat java.base/java.lang.Thread.run(Unknown Source)\r\nCaused by: java.nio.file.NoSuchFileException: C:\\Users\\georgii.borovinskikh\\AppData\\Local\\SLVS_SLOOP\\storageRoot\\68747470733a2f2f736f6e6172636c6f75642e696f2f6f7267616e697a6174696f6e732f64756e63616e702d736f6e61722d74657374\\plugins\\sonarlint-license-plugin-8.0.0.58632-all.jar\r\n\tat java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(Unknown Source)\r\n\tat java.base/java.nio.file.Files.readAttributes(Unknown Source)\r\n\tat java.base/java.util.zip.ZipFile$Source.get(Unknown Source)\r\n\tat java.base/java.util.zip.ZipFile$CleanableResource.(Unknown Source)\r\n\tat java.base/java.util.zip.ZipFile.(Unknown Source)\r\n\tat java.base/java.util.zip.ZipFile.(Unknown Source)\r\n\tat java.base/java.util.jar.JarFile.(Unknown Source)\r\n\tat java.base/java.util.jar.JarFile.(Unknown Source)\r\n\tat java.base/java.util.jar.JarFile.(Unknown Source)\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.loading.SonarPluginManifest.fromJar(SonarPluginManifest.java:97)\r\n\t... 22 more\r\n", + "loggedAt": 1734968894643 + } + """; + var expected = new LogParams + { + message = "Unable to load plugin ...\\storageRoot\\68747470733a2f2f736f6e6172636c6f75642e696f2f6f7267616e697a6174696f6e732f64756e63616e702d736f6e61722d74657374\\plugins\\sonarlint-license-plugin-8.0.0.58632-all.jar", + level = LogLevel.ERROR, + configScopeId = "SLVS_Bound_VS2019", + threadName = "SonarLint Server RPC request executor", + loggerName = "sonarlint", + stackTrace = "java.lang.IllegalStateException: Error while reading plugin manifest from jar: ...\\storageRoot\\68747470733a2f2f736f6e6172636c6f75642e696f2f6f7267616e697a6174696f6e732f64756e63616e702d736f6e61722d74657374\\plugins\\sonarlint-license-plugin-8.0.0.58632-all.jar\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.loading.SonarPluginManifest.fromJar(SonarPluginManifest.java:105)\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.loading.PluginInfo.create(PluginInfo.java:221)\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.loading.SonarPluginRequirementsChecker.checkRequirements(SonarPluginRequirementsChecker.java:64)\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.PluginsLoader.load(PluginsLoader.java:65)\r\n\tat org.sonarsource.sonarlint.core.plugin.PluginsService.loadPlugins(PluginsService.java:189)\r\n\tat org.sonarsource.sonarlint.core.plugin.PluginsService.loadPlugins(PluginsService.java:147)\r\n\tat org.sonarsource.sonarlint.core.plugin.PluginsService.getPlugins(PluginsService.java:136)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisEngineCache.lambda$getOrCreateConnectedEngine$2(AnalysisEngineCache.java:97)\r\n\tat java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisEngineCache.getOrCreateConnectedEngine(AnalysisEngineCache.java:96)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisEngineCache.lambda$getOrCreateAnalysisEngine$1(AnalysisEngineCache.java:91)\r\n\tat java.base/java.util.Optional.map(Unknown Source)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisEngineCache.getOrCreateAnalysisEngine(AnalysisEngineCache.java:91)\r\n\tat org.sonarsource.sonarlint.core.analysis.AnalysisService.analyze(AnalysisService.java:647)\r\n\tat org.sonarsource.sonarlint.core.rpc.impl.AnalysisRpcServiceDelegate.lambda$analyzeFilesAndTrack$8(AnalysisRpcServiceDelegate.java:143)\r\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)\r\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)\r\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)\r\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)\r\n\tat java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\r\n\tat java.base/java.lang.Thread.run(Unknown Source)\r\nCaused by: java.nio.file.NoSuchFileException: C:\\Users\\georgii.borovinskikh\\AppData\\Local\\SLVS_SLOOP\\storageRoot\\68747470733a2f2f736f6e6172636c6f75642e696f2f6f7267616e697a6174696f6e732f64756e63616e702d736f6e61722d74657374\\plugins\\sonarlint-license-plugin-8.0.0.58632-all.jar\r\n\tat java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(Unknown Source)\r\n\tat java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(Unknown Source)\r\n\tat java.base/java.nio.file.Files.readAttributes(Unknown Source)\r\n\tat java.base/java.util.zip.ZipFile$Source.get(Unknown Source)\r\n\tat java.base/java.util.zip.ZipFile$CleanableResource.(Unknown Source)\r\n\tat java.base/java.util.zip.ZipFile.(Unknown Source)\r\n\tat java.base/java.util.zip.ZipFile.(Unknown Source)\r\n\tat java.base/java.util.jar.JarFile.(Unknown Source)\r\n\tat java.base/java.util.jar.JarFile.(Unknown Source)\r\n\tat java.base/java.util.jar.JarFile.(Unknown Source)\r\n\tat org.sonarsource.sonarlint.core.plugin.commons.loading.SonarPluginManifest.fromJar(SonarPluginManifest.java:97)\r\n\t... 22 more\r\n" + }; + + JsonConvert.DeserializeObject(serialzied).Should().BeEquivalentTo(expected, options => options.ComparingByMembers()); + } } } diff --git a/src/SLCore.Listeners/Implementation/LoggerListener.cs b/src/SLCore.Listeners/Implementation/LoggerListener.cs index 3cfdffe610..16787a08b4 100644 --- a/src/SLCore.Listeners/Implementation/LoggerListener.cs +++ b/src/SLCore.Listeners/Implementation/LoggerListener.cs @@ -27,32 +27,28 @@ namespace SonarLint.VisualStudio.SLCore.Listeners.Implementation; [Export(typeof(ISLCoreListener))] [PartCreationPolicy(CreationPolicy.Shared)] -public class LoggerListener : ILoggerListener +[method: ImportingConstructor] +public class LoggerListener(ILogger logger) : ILoggerListener { - private readonly ILogger logger; - - [ImportingConstructor] - public LoggerListener(ILogger logger) - { - this.logger = logger; - } + private readonly ILogger logger = logger.ForContext(SLCoreStrings.SLCoreName); public void Log(LogParams parameters) { - var message = "[SLCORE] " + parameters.message; + var additionalContext = new MessageLevelContext {VerboseContext = [parameters.loggerName, parameters.configScopeId, parameters.threadName]}; switch (parameters.level) { - case LogLevel.ERROR: - case LogLevel.WARN: - logger.WriteLine(message); + case LogLevel.ERROR or LogLevel.WARN: + logger.WriteLine(additionalContext, parameters.message); break; - - case LogLevel.INFO: - case LogLevel.DEBUG: - case LogLevel.TRACE: - logger.LogVerbose(message); + case LogLevel.INFO or LogLevel.DEBUG or LogLevel.TRACE: + logger.LogVerbose(additionalContext, parameters.message); break; } + + if (parameters.stackTrace != null) + { + logger.LogVerbose(additionalContext, parameters.stackTrace); + } } } diff --git a/src/SLCore/Listener/Logger/LogParams.cs b/src/SLCore/Listener/Logger/LogParams.cs index 2f280d2866..f9fd7e64d5 100644 --- a/src/SLCore/Listener/Logger/LogParams.cs +++ b/src/SLCore/Listener/Logger/LogParams.cs @@ -26,6 +26,14 @@ namespace SonarLint.VisualStudio.SLCore.Listener.Logger; public class LogParams { public string message; + // nullable + public string configScopeId; + public string threadName; + public string loggerName; + // nullable + public string stackTrace; + + // private final Instant loggedAt; is ignored [JsonConverter(typeof(StringEnumConverter))] public LogLevel level; diff --git a/src/SLCore/SLCoreStrings.Designer.cs b/src/SLCore/SLCoreStrings.Designer.cs index 655b10580d..fe0e058e30 100644 --- a/src/SLCore/SLCoreStrings.Designer.cs +++ b/src/SLCore/SLCoreStrings.Designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -10,8 +9,8 @@ namespace SonarLint.VisualStudio.SLCore { using System; - - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -23,15 +22,15 @@ namespace SonarLint.VisualStudio.SLCore { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class SLCoreStrings { - + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal SLCoreStrings() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// @@ -45,7 +44,7 @@ internal SLCoreStrings() { return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. @@ -59,7 +58,7 @@ internal SLCoreStrings() { resourceCulture = value; } } - + /// /// Looks up a localized string similar to Internal analysis failure. See logs above.. /// @@ -68,7 +67,7 @@ public static string AnalysisFailedReason { return ResourceManager.GetString("AnalysisFailedReason", resourceCulture); } } - + /// /// Looks up a localized string similar to Updated analysis readiness: {0}. /// @@ -77,7 +76,7 @@ public static string AnalysisReadinessUpdate { return ResourceManager.GetString("AnalysisReadinessUpdate", resourceCulture); } } - + /// /// Looks up a localized string similar to [CertificateChainValidator] Certificate validation failed for the following reason(s):. /// @@ -86,7 +85,7 @@ public static string CertificateValidator_Failed { return ResourceManager.GetString("CertificateValidator_Failed", resourceCulture); } } - + /// /// Looks up a localized string similar to [CertificateChainValidator] {0}: {1}. /// @@ -95,7 +94,7 @@ public static string CertificateValidator_FailureReasonTemplate { return ResourceManager.GetString("CertificateValidator_FailureReasonTemplate", resourceCulture); } } - + /// /// Looks up a localized string similar to [SLCoreAnalyzer] No compilation database found for file: {0}. Check that the file is part of a supported project type in the current solution.. /// @@ -104,7 +103,7 @@ public static string CompilationDatabaseNotFound { return ResourceManager.GetString("CompilationDatabaseNotFound", resourceCulture); } } - + /// /// Looks up a localized string similar to Configuration scope conflict. /// @@ -113,7 +112,7 @@ public static string ConfigScopeConflict { return ResourceManager.GetString("ConfigScopeConflict", resourceCulture); } } - + /// /// Looks up a localized string similar to Configuration scope not initialized. /// @@ -122,7 +121,7 @@ public static string ConfigScopeNotInitialized { return ResourceManager.GetString("ConfigScopeNotInitialized", resourceCulture); } } - + /// /// Looks up a localized string similar to [SLCore.Http] Received server trust verification request.... /// @@ -131,7 +130,7 @@ public static string HttpConfiguration_ServerTrustVerificationRequest { return ResourceManager.GetString("HttpConfiguration_ServerTrustVerificationRequest", resourceCulture); } } - + /// /// Looks up a localized string similar to [SLCore.Http] Server verification result: {0}. /// @@ -140,7 +139,7 @@ public static string HttpConfiguration_ServerTrustVerificationResult { return ResourceManager.GetString("HttpConfiguration_ServerTrustVerificationResult", resourceCulture); } } - + /// /// Looks up a localized string similar to Unexpected enum value. /// @@ -149,7 +148,7 @@ public static string ModelExtensions_UnexpectedValue { return ResourceManager.GetString("ModelExtensions_UnexpectedValue", resourceCulture); } } - + /// /// Looks up a localized string similar to Service Provider is unavailable. /// @@ -158,7 +157,7 @@ public static string ServiceProviderNotInitialized { return ResourceManager.GetString("ServiceProviderNotInitialized", resourceCulture); } } - + /// /// Looks up a localized string similar to [SLCoreHandler] Creating SLCore instance. /// @@ -167,7 +166,7 @@ public static string SLCoreHandler_CreatingInstance { return ResourceManager.GetString("SLCoreHandler_CreatingInstance", resourceCulture); } } - + /// /// Looks up a localized string similar to [SLCoreHandler] Error creating SLCore instance. /// @@ -176,7 +175,7 @@ public static string SLCoreHandler_CreatingInstanceError { return ResourceManager.GetString("SLCoreHandler_CreatingInstanceError", resourceCulture); } } - + /// /// Looks up a localized string similar to Current instance is alive. /// @@ -185,7 +184,7 @@ public static string SLCoreHandler_InstanceAlreadyRunning { return ResourceManager.GetString("SLCoreHandler_InstanceAlreadyRunning", resourceCulture); } } - + /// /// Looks up a localized string similar to [SLCoreHandler] SLCore instance exited. /// @@ -194,7 +193,7 @@ public static string SLCoreHandler_InstanceDied { return ResourceManager.GetString("SLCoreHandler_InstanceDied", resourceCulture); } } - + /// /// Looks up a localized string similar to [SLCoreHandler] Starting SLCore instance. /// @@ -203,7 +202,7 @@ public static string SLCoreHandler_StartingInstance { return ResourceManager.GetString("SLCoreHandler_StartingInstance", resourceCulture); } } - + /// /// Looks up a localized string similar to [SLCoreHandler] Error starting SLCore instance. /// @@ -212,7 +211,16 @@ public static string SLCoreHandler_StartingInstanceError { return ResourceManager.GetString("SLCoreHandler_StartingInstanceError", resourceCulture); } } - + + /// + /// Looks up a localized string similar to SLCore. + /// + public static string SLCoreName { + get { + return ResourceManager.GetString("SLCoreName", resourceCulture); + } + } + /// /// Looks up a localized string similar to [SLCoreServiceProvider]Cannot Create Service. Error: {0}. /// @@ -221,7 +229,7 @@ public static string SLCoreServiceProvider_CreateServiceError { return ResourceManager.GetString("SLCoreServiceProvider_CreateServiceError", resourceCulture); } } - + /// /// Looks up a localized string similar to SonarQube for Visual Studio background service failed to start. /// @@ -230,7 +238,7 @@ public static string SloopRestartFailedNotificationService_GoldBarMessage { return ResourceManager.GetString("SloopRestartFailedNotificationService_GoldBarMessage", resourceCulture); } } - + /// /// Looks up a localized string similar to Restart SonarQube for Visual Studio. /// @@ -239,7 +247,7 @@ public static string SloopRestartFailedNotificationService_Restart { return ResourceManager.GetString("SloopRestartFailedNotificationService_Restart", resourceCulture); } } - + /// /// Looks up a localized string similar to Unexpected server connection type. /// @@ -248,7 +256,7 @@ public static string UnexpectedServerConnectionType { return ResourceManager.GetString("UnexpectedServerConnectionType", resourceCulture); } } - + /// /// Looks up a localized string similar to Proxy type can not be determined from scheme '{0}'. Returning HTTP proxy type.. /// diff --git a/src/SLCore/SLCoreStrings.resx b/src/SLCore/SLCoreStrings.resx index dbf2242e14..2759b7f49b 100644 --- a/src/SLCore/SLCoreStrings.resx +++ b/src/SLCore/SLCoreStrings.resx @@ -183,4 +183,7 @@ [SLCoreAnalyzer] No compilation database found for file: {0}. Check that the file is part of a supported project type in the current solution. + + SLCore + \ No newline at end of file diff --git a/src/TestInfrastructure/Framework/TestLogger.cs b/src/TestInfrastructure/Framework/TestLogger.cs index ad21b614fe..44000fddc4 100644 --- a/src/TestInfrastructure/Framework/TestLogger.cs +++ b/src/TestInfrastructure/Framework/TestLogger.cs @@ -32,15 +32,16 @@ public class TestLogger : ILogger, ILoggerWriter, ILoggerSettingsProvider private readonly bool logToConsole; private readonly bool logThreadId; + private readonly bool logVerbose; private readonly ILogger logger; - public TestLogger(bool logToConsole = false, bool logThreadId = false) + public TestLogger(bool logToConsole = false, bool logThreadId = false, bool logVerbose = true) { // When executing tests in VS, the console output will automatically be captured by // the test runner. The Properties window for the test result will have an "Output" // link to show the output. this.logToConsole = logToConsole; - + this.logVerbose = logVerbose; this.logThreadId = logThreadId; logger = LoggerFactory.Default.Create(this, this); } @@ -125,7 +126,7 @@ void ILoggerWriter.WriteLine(string message) LogMessageAdded?.Invoke(this, EventArgs.Empty); } - bool ILoggerSettingsProvider.IsVerboseEnabled => true; + bool ILoggerSettingsProvider.IsVerboseEnabled => logVerbose; bool ILoggerSettingsProvider.IsThreadIdEnabled => logThreadId; } }