Tree-based message logging and toggleable trace printing (#728)

* Log message tree

* Log when message execution deferred

* Tree structure in traces

* Fix ordering when queue partially consumed

* Change some log settings and wording

* Revert default max log level to debug

* Change messages to On/Names/Contents as log::info, change trace to toggle, rename GlobalMessage to DebugMessage

* DebugPrintDocument cleanup

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2022-07-23 01:33:21 +01:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent a0c22d20b6
commit db82cf69a4
15 changed files with 191 additions and 102 deletions
+2 -8
View File
@@ -322,7 +322,6 @@ fn path_intersections(a: &SubCurve, b: &SubCurve, intersections: &mut Vec<Inters
cross.t_a = a.start_t + cross.t_a * recursion;
cross.quality = guess_quality(a.curve, b.curve, &cross);
// log::debug!("checking: {:?}", cross.quality);
if cross.quality <= F64LOOSE {
// Invalid intersections should still be rejected
// Rejects "valid" intersections on the non-inclusive end of a `PathSeg`
@@ -336,7 +335,7 @@ fn path_intersections(a: &SubCurve, b: &SubCurve, intersections: &mut Vec<Inters
// Return the best estimate of intersection regardless of quality
// Also provides a base case and prevents infinite recursion
if a.available_precision() <= F64PRECISE || b.available_precision() <= F64PRECISE {
log::debug!("precision reached");
log::trace!("Precision reached");
intersections.push(cross);
return;
}
@@ -344,7 +343,7 @@ fn path_intersections(a: &SubCurve, b: &SubCurve, intersections: &mut Vec<Inters
// Alternate base case
// Note: may occur for the less forgiving side of a `PathSeg` endpoint intersect
if a.available_precision() <= F64PRECISE || b.available_precision() <= F64PRECISE {
log::debug!("precision reached without finding intersect");
log::trace!("Precision reached without finding intersect");
return;
}
}
@@ -658,9 +657,6 @@ pub fn point_t_value(a: &PathSeg, p: &Point) -> Option<f64> {
}
pub fn intersections(a: &BezPath, b: &BezPath) -> Vec<Intersect> {
// log::info!("{:?}", a.to_svg());
// log::info!("{:?}", b.to_svg());
let mut intersections: Vec<Intersect> = Vec::new();
// There is some duplicate computation of b_extrema here, but I doubt it's significant
a.segments().enumerate().for_each(|(a_index, a_seg)| {
@@ -676,8 +672,6 @@ pub fn intersections(a: &BezPath, b: &BezPath) -> Vec<Intersect> {
})
});
// log::info!("{:?}", intersections);
intersections
}