Skip to content

Commit

Permalink
Fixed Log Parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisFeline committed Jan 29, 2024
1 parent 4279f4d commit ef15acf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Utils/LogWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,16 @@ private bool ParseDisplayName(string line, DateTime lineDate, LogContext logCont
if (!line.Contains(UserAuthKeyword)) return false;

int index = line.IndexOf(UserAuthKeyword) + UserAuthKeyword.Length;
int length = line.IndexOf(" (usr_", index) - index;
int length = line.IndexOf(" (", index) - index;

string displayName = line.Substring(index, length);
logContext.DisplayName = displayName;
if (index > -1 && length > 0)
{
string displayName = line.Substring(index, length);
logContext.DisplayName = displayName;
} else
{
logContext.DisplayName = "Unknown";
}

return true;
}
Expand Down

0 comments on commit ef15acf

Please sign in to comment.