Skip to content

Commit

Permalink
Merge pull request #1042 from corbob/Debugging-Changes
Browse files Browse the repository at this point in the history
(#967) Parse Info messages for errors
  • Loading branch information
gep13 authored Apr 5, 2024
2 parents be17f22 + 28155f8 commit 86e6f63
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public class ChocolateyService : IChocolateyService
private readonly IConfigService _configService;
private GetChocolatey _choco;
private string _localAppDataPath = string.Empty;
#pragma warning disable SA1401 // Fields must be private
#pragma warning restore SA1401 // Fields must be private
private const string ErrorRegex = "^\\s*(ERROR|FATAL|WARN)";

public ChocolateyService(IMapper mapper, IProgressService progressService, IChocolateyConfigSettingsService configSettingsService, IXmlService xmlService, IFileSystem fileSystem, IConfigService configService)
{
Expand Down Expand Up @@ -677,6 +676,13 @@ private static List<string> GetErrors(out Action<LogMessage> grabErrors)
case LogLevel.Error:
case LogLevel.Fatal:
errors.Add(m.Message);
break;
case LogLevel.Info:
if (System.Text.RegularExpressions.Regex.IsMatch(m.Message, ErrorRegex))
{
errors.Add(m.Message);
}

break;
}
};
Expand Down

0 comments on commit 86e6f63

Please sign in to comment.