Skip to content

Commit

Permalink
Diagnose command for Elmah.Io.Extensions.Logging also check correct u…
Browse files Browse the repository at this point in the history
…sing to make sure that the right AddElmahIo method is called and not the one from Elmah.Io.AspNetCore.
  • Loading branch information
ThomasArdal committed Oct 24, 2023
1 parent 4da84a4 commit 8be02df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Elmah.Io.Cli/Diagnose/ElmahIoExtensionsLogging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ internal static void Diagnose(FileInfo packageFile, Dictionary<string, string> p
if (File.Exists(programPath))
{
var programCs = File.ReadAllText(programPath);
if (!programCs.Contains(".AddElmahIo("))
ReportError("A call to AddElmahIo was not found in Program.cs.");
if (!programCs.Contains(".AddElmahIo(") || !programCs.Contains("using Elmah.Io.Extensions.Logging"))
ReportError("A call to AddElmahIo was not found in Program.cs. Both Elmah.Io.Extensions.Logging and Elmah.Io.AspNetCore provide a method named AddElmahIo. Make sure to call both if you have both packages installed.");

var apiKeyLookup = LookupString(programCs, ".AddElmahIo(", ".ApiKey = \"", 32);
if (apiKeyLookup != null) apiKey = apiKeyLookup;
Expand Down

0 comments on commit 8be02df

Please sign in to comment.