Skip to content

Commit

Permalink
Make RAR use ShouldLogMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
ladipro committed Apr 29, 2021
1 parent a323388 commit 9fc5b3f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,15 +1247,15 @@ quiet at the engine level.
}

#if FEATURE_WIN32_REGISTRY
if (dependencyTable.Resolvers != null)
MessageImportance messageImportance = MessageImportance.Low;
if (dependencyTable.Resolvers != null && Log.ShouldLogMessage(messageImportance))
{
foreach (Resolver r in dependencyTable.Resolvers)
{
if (r is AssemblyFoldersExResolver)
{
AssemblyFoldersEx assemblyFoldersEx = ((AssemblyFoldersExResolver)r).AssemblyFoldersExLocations;

MessageImportance messageImportance = MessageImportance.Low;
if (assemblyFoldersEx != null && _showAssemblyFoldersExLocations.TryGetValue(r.SearchPath, out messageImportance))
{
Log.LogMessageFromResources(messageImportance, "ResolveAssemblyReference.AssemblyFoldersExSearchLocations", r.SearchPath);
Expand Down Expand Up @@ -1347,6 +1347,10 @@ private void LogReference(Reference reference, string fusionName)
{
// Set an importance level to be used for secondary messages.
MessageImportance importance = ChooseReferenceLoggingImportance(reference);
if (!Log.ShouldLogMessage(importance))
{
return;
}

// Log the fusion name and whether this is a primary or a dependency.
LogPrimaryOrDependency(reference, fusionName, importance);
Expand Down Expand Up @@ -1413,15 +1417,15 @@ private MessageImportance ChooseReferenceLoggingImportance(Reference reference)
/// </summary>
private void LogInputs()
{
if (Traits.Instance.EscapeHatches.LogTaskInputs || Silent)
MessageImportance importance = MessageImportance.Low;
if (Traits.Instance.EscapeHatches.LogTaskInputs || Silent || !Log.ShouldLogMessage(importance))
{
// the inputs will be logged automatically anyway, avoid duplication in the logs
return;
}

string indent = Strings.FourSpaces;
string property = Strings.LogTaskPropertyFormat;
MessageImportance importance = MessageImportance.Low;

Log.LogMessage(importance, property, "TargetFrameworkMoniker");
Log.LogMessage(importance, indent + _targetedFrameworkMoniker);
Expand Down

0 comments on commit 9fc5b3f

Please sign in to comment.