fix(tvix/eval): don't print full values in observer
This can actually blow up when tracing arbitrary execution, as some of the data structures just get too large to run through a tabwriter. Change-Id: I6ec4c30ee48655b8a62954ca219107404fb2c256 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8200 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
parent
fb4ea1f5a4
commit
19106cdaf0
1 changed files with 14 additions and 1 deletions
|
@ -150,11 +150,24 @@ impl<W: Write> TracingObserver<W> {
|
|||
}
|
||||
}
|
||||
|
||||
fn write_value(&mut self, val: &Value) {
|
||||
let _ = match val {
|
||||
// Potentially large types which we only want to print
|
||||
// the type of (and avoid recursing).
|
||||
Value::List(l) => write!(&mut self.writer, "list[{}] ", l.len()),
|
||||
Value::Attrs(a) => write!(&mut self.writer, "attrs[{}] ", a.len()),
|
||||
Value::Thunk(t) if t.is_evaluated() => Ok(self.write_value(&t.value())),
|
||||
|
||||
// For other value types, defer to the standard value printer.
|
||||
_ => write!(&mut self.writer, "{} ", val),
|
||||
};
|
||||
}
|
||||
|
||||
fn write_stack(&mut self, stack: &[Value]) {
|
||||
let _ = write!(&mut self.writer, "[ ");
|
||||
|
||||
for val in stack {
|
||||
let _ = write!(&mut self.writer, "{} ", val);
|
||||
self.write_value(&val);
|
||||
}
|
||||
|
||||
let _ = writeln!(&mut self.writer, "]");
|
||||
|
|
Loading…
Reference in a new issue