- Fixed assembly logging style.
- Fixed double logging during execution.
This commit is contained in:
@@ -315,24 +315,16 @@ public sealed class AssemblyLoader : AssemblyLoadContext, IAssemblyLoaderService
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var resultDiagnostic in result.Diagnostics)
|
||||
{
|
||||
if (resultDiagnostic.Severity != DiagnosticSeverity.Error)
|
||||
if (resultDiagnostic.IsWarningAsError || resultDiagnostic.Severity == DiagnosticSeverity.Error)
|
||||
{
|
||||
continue;
|
||||
//sb.AppendLine($">>> {resultDiagnostic.GetMessage()} | Location: {resultDiagnostic.Location.SourceTree?.GetLineSpan(resultDiagnostic.Location.SourceSpan)} ");
|
||||
sb.AppendLine($"\n{resultDiagnostic}");
|
||||
}
|
||||
sb.AppendLine($">>> {resultDiagnostic.GetMessage()} | Location: {resultDiagnostic.Location.SourceTree?.GetLineSpan(resultDiagnostic.Location.SourceSpan)} ");
|
||||
}
|
||||
var res = new FluentResults.Result().WithError(
|
||||
new Error($"Package Error: {OwnerPackage.Name}: Compilation failed for assembly {assemblyName}! {sb.ToString()}\n")
|
||||
new Error($"Package Error: {OwnerPackage.Name}: Compilation failed for assembly {assemblyName}!\n {sb.ToString()}\n")
|
||||
.WithMetadata(MetadataType.ExceptionObject, this)
|
||||
.WithMetadata(MetadataType.RootObject, syntaxTrees));
|
||||
var failuresDiag =
|
||||
result.Diagnostics.Where(d => d.IsWarningAsError || d.Severity == DiagnosticSeverity.Error);
|
||||
foreach (var diag in failuresDiag)
|
||||
{
|
||||
res = res.WithError(new Error(diag.GetMessage())
|
||||
.WithMetadata(MetadataType.ExceptionObject, this)
|
||||
.WithMetadata(MetadataType.ExceptionDetails, diag.Descriptor.Description));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -186,14 +186,13 @@ public partial class LoggerService : ILoggerService
|
||||
else
|
||||
{
|
||||
LogError($"FluentResults::IError: {error.Message}");
|
||||
}
|
||||
|
||||
if (error.Reasons != null)
|
||||
{
|
||||
foreach (var reason in error.Reasons)
|
||||
/*if (error.Reasons != null)
|
||||
{
|
||||
LogError($" - {reason.Message}");
|
||||
}
|
||||
foreach (var reason in error.Reasons)
|
||||
{
|
||||
LogError($" - {reason.Message}");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,11 +357,7 @@ public sealed class PackageManagementService : IPackageManagementService
|
||||
{
|
||||
_runningPackages[package.Key] = package.Value;
|
||||
}
|
||||
|
||||
if (result.IsFailed)
|
||||
{
|
||||
_logger.LogResults(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user