Skip to content

Commit

Permalink
wrap NewLogData in try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Razzmatazzz committed Jan 21, 2024
1 parent c459272 commit 47e4413
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion TarkovMonitor/GameWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ internal void GameWatcher_NewLogData(object? sender, NewLogDataEventArgs e)
try
{
//DebugMessage?.Invoke(this, new DebugEventArgs(e.NewMessage));
NewLogData?.Invoke(this, e);
try
{
NewLogData?.Invoke(this, e);
} catch (Exception ex)
{
ExceptionThrown?.Invoke(this, new ExceptionEventArgs(ex, $"raising {e.Type} new log data event {e.Data}"));
}
var logPattern = @"(?<message>^\d{4}-\d{2}-\d{2}.+$)\s*(?<json>^{[\s\S]+?^})?";
//var logPattern = @"(?<date>^\d{4}-\d{2}-\d{2}) (?<time>\d{2}:\d{2}:\d{2}\.\d{3} [+-]\d{2}:\d{2})\|(?<version>\d+\.\d+\.\d+\.\d+\.\d+)\|(?<logLevel>[^|]+)\|(?<logType>[^|]+)\|(?<message>.+$)\s*(?<json>^{[\s\S]+?^})?";
var logMessages = Regex.Matches(e.Data, logPattern, RegexOptions.Multiline);
Expand Down

0 comments on commit 47e4413

Please sign in to comment.