Skip to content

Add optional file logging, and add logging for heartbeat disconnects #160

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Trogluddite
Copy link

@Trogluddite Trogluddite commented Mar 26, 2025

This change adds:

  1. Optional logging to a file
  2. a log event when 'Heartbeat Timeout' type disconnects occur

Testing

Existing unit tests pass; no new tests added.

Basic functional testing (listed below) was made with release builds on these targets:

aarch64-apple-darwin
x86_64-unknown-linux-gnu
  • server can start
  • client can connect to server
  • interrupted connection (severed VPN between client & server) causes heartbeat failure and disconnect
  • server drops socket on graceful client disconnect
  • default 'trace logs to stdout' behavior is preserved with escape sequences coloring output
  • new 'trace logs to file' behavior functions as expected (sans escape sequences).

Test build using (on both linux and MacOS):

rustc 1.85.1 (4eb161250 2025-03-15)
LLVM version: 19.1.7

New Dependencies:

time = "0.3.35"
tracing-appender = "0.2.3"

@Trogluddite Trogluddite deleted the add_optional_file_logging branch March 26, 2025 19:17
@Trogluddite Trogluddite restored the add_optional_file_logging branch March 26, 2025 19:19
@Trogluddite Trogluddite reopened this Mar 26, 2025
@@ -127,6 +128,7 @@ impl Server {
loop {
if stream.send(ServerMessage::Heartbeat).await.is_err() {
// Assume that the TCP connection has been dropped.
info!(peer_addr, "connection dropped after heartbeat timeout");
Copy link
Author

Choose a reason for hiding this comment

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

Example log events:

2025-03-26T21:40:35.281814Z  INFO control{addr=172.31.11.42:49554}: bore_cli::server: connection dropped after heartbeat timeout peer_addr="172.31.11.42:49554"
2025-03-26T21:40:35.281852Z  INFO control{addr=172.31.11.42:49554}: bore_cli::server: connection exited

This just gives us a little more info about why the client disconnected.

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.

1 participant