Skip to content

Commit 1db95e6

Browse files
committed
feat: enable debug logging for challenges and broker
- Add debug directives for challenge_orchestrator, challenge_runtime, secure_container_runtime - Enable debug level by default in container-broker - Log all broker requests with type and request_id - Add request_type() method to protocol Request enum
1 parent e56a639 commit 1db95e6

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

crates/platform-server/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,17 @@ async fn main() -> anyhow::Result<()> {
9191
tracing_subscriber::fmt()
9292
.with_env_filter(
9393
tracing_subscriber::EnvFilter::from_default_env()
94+
// Platform server itself
9495
.add_directive("platform_server=debug".parse().unwrap())
96+
// Challenge orchestration and runtime
97+
.add_directive("challenge_orchestrator=debug".parse().unwrap())
98+
.add_directive("challenge_runtime=debug".parse().unwrap())
99+
.add_directive("platform_challenge_sdk=debug".parse().unwrap())
100+
// Container broker
101+
.add_directive("secure_container_runtime=debug".parse().unwrap())
102+
// Term challenge (when proxied)
103+
.add_directive("term_challenge=debug".parse().unwrap())
104+
// Default level
95105
.add_directive("info".parse().unwrap()),
96106
)
97107
.init();

crates/secure-container-runtime/src/bin/container-broker.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ const DEFAULT_HTTP_PORT: u16 = 8091;
3232

3333
#[tokio::main]
3434
async fn main() -> anyhow::Result<()> {
35-
// Initialize logging
35+
// Initialize logging - use RUST_LOG env var or default to debug for broker
36+
let log_level = std::env::var("RUST_LOG")
37+
.ok()
38+
.and_then(|s| s.parse().ok())
39+
.unwrap_or(Level::DEBUG);
40+
3641
FmtSubscriber::builder()
37-
.with_max_level(Level::INFO)
38-
.with_target(false)
42+
.with_max_level(log_level)
43+
.with_target(true) // Show module path for debugging
3944
.with_thread_ids(false)
40-
.compact()
4145
.init();
4246

4347
info!("Container Broker starting...");

crates/secure-container-runtime/src/broker.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,14 @@ impl ContainerBroker {
147147

148148
/// Handle a single request
149149
pub async fn handle_request(&self, request: Request) -> Response {
150-
let _request_id = request.request_id().to_string();
150+
let request_id = request.request_id().to_string();
151+
152+
// Log all incoming requests for debugging
153+
debug!(
154+
request_id = %request_id,
155+
request_type = %request.request_type(),
156+
"Handling broker request"
157+
);
151158

152159
match request {
153160
Request::Ping { request_id } => Response::Pong {

crates/secure-container-runtime/src/protocol.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,24 @@ impl Request {
114114
}
115115
}
116116

117+
/// Get request type as string for logging
118+
pub fn request_type(&self) -> &'static str {
119+
match self {
120+
Request::Create { .. } => "create",
121+
Request::Start { .. } => "start",
122+
Request::Stop { .. } => "stop",
123+
Request::Remove { .. } => "remove",
124+
Request::Exec { .. } => "exec",
125+
Request::Inspect { .. } => "inspect",
126+
Request::List { .. } => "list",
127+
Request::Logs { .. } => "logs",
128+
Request::Pull { .. } => "pull",
129+
Request::Ping { .. } => "ping",
130+
Request::CopyFrom { .. } => "copy_from",
131+
Request::CopyTo { .. } => "copy_to",
132+
}
133+
}
134+
117135
/// Get challenge_id if applicable
118136
pub fn challenge_id(&self) -> Option<&str> {
119137
match self {

0 commit comments

Comments
 (0)