Skip to content
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

Added 'info' log level to agent logs in mirrord-protocol #3026

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions changelog.d/+added-log-leve.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Extended `mirrord-protocol` with info logs from the agent.
3 changes: 2 additions & 1 deletion mirrord/cli/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use tokio::{
sync::mpsc::{self, UnboundedReceiver},
};
use tokio_util::sync::CancellationToken;
use tracing::{debug, error, trace, warn, Level};
use tracing::{debug, error, info, trace, warn, Level};

#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
use crate::extract::extract_arm64;
Expand Down Expand Up @@ -550,6 +550,7 @@ impl MirrordExecution {
match msg.level {
LogLevel::Error => error!("Agent log: {}", msg.message),
LogLevel::Warn => warn!("Agent log: {}", msg.message),
LogLevel::Info => info!("Agent log: {}", msg.message),
}

continue;
Expand Down
2 changes: 2 additions & 0 deletions mirrord/cli/src/port_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ impl PortForwarder {
DaemonMessage::LogMessage(log_message) => match log_message.level {
LogLevel::Warn => tracing::warn!("agent log: {}", log_message.message),
LogLevel::Error => tracing::error!("agent log: {}", log_message.message),
LogLevel::Info => tracing::info!("agent log: {}", log_message.message),
},
DaemonMessage::Close(error) => {
return Err(PortForwardError::AgentError(error));
Expand Down Expand Up @@ -556,6 +557,7 @@ impl ReversePortForwarder {
DaemonMessage::LogMessage(log_message) => match log_message.level {
LogLevel::Warn => tracing::warn!("agent log: {}", log_message.message),
LogLevel::Error => tracing::error!("agent log: {}", log_message.message),
LogLevel::Info => tracing::info!("agent log: {}", log_message.message),
},
DaemonMessage::Close(error) => {
return Err(PortForwardError::AgentError(error));
Expand Down
1 change: 1 addition & 0 deletions mirrord/intproxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ impl IntProxy {
DaemonMessage::LogMessage(log) => match log.level {
LogLevel::Error => tracing::error!("agent log: {}", log.message),
LogLevel::Warn => tracing::warn!("agent log: {}", log.message),
LogLevel::Info => tracing::info!("agent log: {}", log.message),
},
DaemonMessage::GetEnvVarsResponse(res) => {
self.task_txs
Expand Down
2 changes: 1 addition & 1 deletion mirrord/protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mirrord-protocol"
version = "1.13.3"
version = "1.13.4"
authors.workspace = true
description.workspace = true
documentation.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions mirrord/protocol/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ use crate::{
ResponseError,
};

/// Minimal mirrord-protocol version that that allows [`LogLevel::Info`].
pub static INFO_LOG_VERSION: LazyLock<VersionReq> =
LazyLock::new(|| ">=1.13.4".parse().expect("Bad Identifier"));

#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, Copy)]
pub enum LogLevel {
Warn,
Error,
/// Supported from [`INFO_LOG_VERSION`].
Info,
}

#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)]
Expand Down
3 changes: 3 additions & 0 deletions mirrord/vpn/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ impl Stream for VpnAgent {
LogLevel::Warn => {
tracing::warn!(message = %message.message, "agent sent warn message")
}
LogLevel::Info => {
tracing::info!(message = %message.message, "agent sent info message")
}
}

self.poll_next(cx)
Expand Down
Loading