Skip to content

Conversation

@NickCraver
Copy link
Collaborator

This tweaks logging a bit to make it easier to parse and switches timings to ValueStopwatch while I'm in here adding one. Helps investigate things like #2017.

@NickCraver NickCraver marked this pull request as ready for review March 3, 2022 02:46
}
}
}
public void WriteLine(string prefix, string message)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider an int indent instead of string prefix?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but overall it'd be doing a string creation and allocation that way so kept it simple :)

foreach (var ex in aex.InnerExceptions)
{
log?.WriteLine($"{Format.ToString(server)}: Faulted: {ex.Message}");
log?.WriteLine($" {Format.ToString(server)}: Faulted: {ex.Message}");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these Format.ToString() calls necessary? It looks like ServerEndPoint already overrides ToString to do that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question - I would like to change these everywhere but going consistent for this PR and want to do those all at once :)


await Maintenance.ServerMaintenanceEvent.AddListenersAsync(muxer, logProxy).ForAwait();

logProxy?.WriteLine($"Total connect time: {sw.ElapsedMilliseconds:n0} ms");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any value in knowing how long it took to fail to connect? If so, you could move these "Total connect time" lines into the finally

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I debated that as well - I feel like that might be confusing to give a total time when it just blew sky high for no reason - in those cases we care more about the log of what went sky high or what was the last thing logged, rather than the time...I think.

@NickCraver NickCraver merged commit ee687dc into main Mar 3, 2022
@NickCraver NickCraver deleted the craver/connection-logging branch March 3, 2022 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants