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

(#967) Parse Info messages for errors #1042

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Changes from all commits
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
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
Loading