Skip to content

Commit

Permalink
debug logging edgelet
Browse files Browse the repository at this point in the history
  • Loading branch information
and-rewsmith committed Mar 1, 2023
1 parent 3da72f9 commit 1aa17bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions edgelet/support-bundle/src/runtime_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,20 @@ pub async fn write_logs(
options: &LogOptions,
writer: &mut (impl Write + Send),
) -> anyhow::Result<()> {
println!("getting logs stream: {:?}", module_name);
// Collect Logs
let mut logs = runtime
.logs(module_name, options)
.await
.context(Error::Write)?;

println!("processing logs stream: {:?}", module_name);
while let Some(bytes) = logs.try_next().await.context(Error::Write)? {
println!(
"writing {:?} bytes from logs stream: {:?}",
bytes.len(),
module_name
);
// First 4 bytes represent stderr vs stdout, we currently don't display differently based on that.
// Next 4 bytes represent length of chunk, rust already encodes this information in the slice.
if bytes.len() > 8 {
Expand Down
2 changes: 2 additions & 0 deletions edgelet/support-bundle/src/support_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ where

// Get all modules
for module_name in get_modules(runtime, include_ms_only).await {
println!("processing module: {:?}", module_name);
println!("zipwriter starting file: {:?}", module_name);
// Write module logs
zip_writer
.start_file(format!("logs/{}_log.txt", module_name), file_options)
Expand Down

0 comments on commit 1aa17bf

Please sign in to comment.