Make tracing configurable, when relevant.

Tracing is now turn OFF by default when:

  - building project
  - building documentation
  - building dependencies

  It can be turned ON only when building project using `--keep-traces`.
  That means it's not possible to build dependencies with traces. The
  address `--rebuild` flag will also rebuild without traces.

  Tracing is however turn ON by default when:

  - checking the project (and running tests).

  In this scenario, tracing can be disabled using `--no-traces` (if for
  example, one want to analyze the execution units of specific functions
  without having to manually remove traces from code).
This commit is contained in:
KtorZ
2023-02-16 14:33:19 +01:00
committed by Lucas
parent e9e3f4f50a
commit 45454ced01
6 changed files with 56 additions and 15 deletions

View File

@@ -1023,6 +1023,16 @@ pub enum Tracing {
KeepTraces,
}
impl From<bool> for Tracing {
fn from(keep: bool) -> Self {
if keep {
Tracing::KeepTraces
} else {
Tracing::NoTraces
}
}
}
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct Span {
pub start: usize,