Skip to content

Commit

Permalink
fix: Dont create pdk logs in CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Feb 23, 2024
1 parent f145c9a commit 26bd9db
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions nextgen/pdk-test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod wrappers;

use serde::Serialize;
use std::collections::{BTreeMap, HashMap};
use std::env;
use std::fs::{self, OpenOptions};
use std::io::Write;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -59,18 +60,20 @@ pub fn create_plugin_container_with_config(
}

// TODO redo
let _ = extism::set_log_callback(
move |line| {
let mut file = OpenOptions::new()
.create(true)
.append(true)
.open(&log_file)
.unwrap();

file.write_all(line.as_bytes()).unwrap();
},
"trace",
);
if env::var("CI").is_err() {
let _ = extism::set_log_callback(
move |line| {
let mut file = OpenOptions::new()
.create(true)
.append(true)
.open(&log_file)
.unwrap();

file.write_all(line.as_bytes()).unwrap();
},
"trace",
);
}

PluginContainer::new(id, manifest, funcs).unwrap()
}
Expand Down

0 comments on commit 26bd9db

Please sign in to comment.