Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduced MsBuild log output and consistent use of [Reqnroll] prefix #381

Merged
merged 5 commits into from
Jan 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rename LogMessageWithLowImportance to LogDiagnosticMessage
gasparnagy committed Jan 10, 2025
commit bb1f02d436016fb7b01167aba2d69ca79ec9fc0f
8 changes: 4 additions & 4 deletions Reqnroll.Tools.MsBuild.Generation/AssemblyResolveLogger.cs
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public AssemblyResolveLogger(ITaskLoggingWrapper taskLoggingWrapper)

public Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
_taskLoggingWrapper.LogMessageWithLowImportance($"Resolving {args.Name}");
_taskLoggingWrapper.LogDiagnosticMessage($"Resolving {args.Name}");

try
{
@@ -34,7 +34,7 @@ public Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs ar
var loadedAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == requestedAssemblyName.Name);
if (loadedAssembly != null)
{
_taskLoggingWrapper.LogMessageWithLowImportance($" Loading {args.Name} from loaded assembly ('{loadedAssembly.FullName}')");
_taskLoggingWrapper.LogDiagnosticMessage($" Loading {args.Name} from loaded assembly ('{loadedAssembly.FullName}')");
return loadedAssembly;
}

@@ -43,12 +43,12 @@ public Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs ar
var assemblyPath = Path.Combine(_taskFolder, requestedAssemblyName.Name + ".dll");
if (File.Exists(assemblyPath))
{
_taskLoggingWrapper.LogMessageWithLowImportance($" Loading {args.Name} from {assemblyPath}");
_taskLoggingWrapper.LogDiagnosticMessage($" Loading {args.Name} from {assemblyPath}");
return Assembly.LoadFrom(assemblyPath);
}
}

_taskLoggingWrapper.LogMessageWithLowImportance($" {args.Name} is not in folder {_taskFolder}");
_taskLoggingWrapper.LogDiagnosticMessage($" {args.Name} is not in folder {_taskFolder}");
}
catch (Exception ex)
{
2 changes: 1 addition & 1 deletion Reqnroll.Tools.MsBuild.Generation/ITaskLoggingWrapper.cs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ public interface ITaskLoggingWrapper
{
void LogMessage(string message);

void LogMessageWithLowImportance(string message);
void LogDiagnosticMessage(string message);

void LogError(string message);

Original file line number Diff line number Diff line change
@@ -35,14 +35,14 @@ public async Task TryTransmitProjectCompilingEventAsync()

if (transmissionResult is IFailure failure)
{
_taskLoggingWrapper.LogMessageWithLowImportance($"Could not transmit analytics: {failure}");
_taskLoggingWrapper.LogDiagnosticMessage($"Could not transmit analytics: {failure}");
}
}
catch (Exception exc)
{
// catch all exceptions since we do not want to break the build simply because event creation failed
// but still return an error containing the exception to at least log it
_taskLoggingWrapper.LogMessageWithLowImportance($"Could not transmit analytics: {exc}");
_taskLoggingWrapper.LogDiagnosticMessage($"Could not transmit analytics: {exc}");
}
}

10 changes: 5 additions & 5 deletions Reqnroll.Tools.MsBuild.Generation/ProcessInfoDumper.cs
Original file line number Diff line number Diff line change
@@ -19,11 +19,11 @@ public void DumpProcessInfo()
try
{
var currentProcess = Process.GetCurrentProcess();
_taskLoggingWrapper.LogMessageWithLowImportance($"process: {currentProcess.ProcessName}, .NET: {RuntimeInformation.FrameworkDescription}, pid: {currentProcess.Id}, CD: {Environment.CurrentDirectory}");
_taskLoggingWrapper.LogDiagnosticMessage($"process: {currentProcess.ProcessName}, .NET: {RuntimeInformation.FrameworkDescription}, pid: {currentProcess.Id}, CD: {Environment.CurrentDirectory}");
}
catch (Exception e)
{
_taskLoggingWrapper.LogMessageWithLowImportance($"Error when dumping process info: {e}");
_taskLoggingWrapper.LogDiagnosticMessage($"Error when dumping process info: {e}");
}
DumpLoadedAssemblies();
}
@@ -32,17 +32,17 @@ public void DumpLoadedAssemblies()
{
try
{
_taskLoggingWrapper.LogMessageWithLowImportance("Loaded assemblies:");
_taskLoggingWrapper.LogDiagnosticMessage("Loaded assemblies:");

foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().OrderBy(a => a.FullName))
{
var location = assembly.IsDynamic ? "<dyn>" : assembly.Location;
_taskLoggingWrapper.LogMessageWithLowImportance($" {assembly.FullName};{location}");
_taskLoggingWrapper.LogDiagnosticMessage($" {assembly.FullName};{location}");
}
}
catch (Exception e)
{
_taskLoggingWrapper.LogMessageWithLowImportance($"Error when dumping loaded assemblies: {e}");
_taskLoggingWrapper.LogDiagnosticMessage($"Error when dumping loaded assemblies: {e}");
}
}
}
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ public void LogMessage(string message)
_taskLoggingHelper.LogMessage(messageWithNameTag);
}

public void LogMessageWithLowImportance(string message)
public void LogDiagnosticMessage(string message)
{
string messageWithNameTag = GetMessageWithNameTag(message);
_taskLoggingHelper.LogMessage(MessageImportance.Low, messageWithNameTag);