add tracing crate for logging

This commit is contained in:
Moritz Hölting 2024-06-15 21:46:47 +02:00
parent cef1dab727
commit e31f9f904a
5 changed files with 11 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
/dist
/target
/Cargo.lock

View File

@ -21,4 +21,5 @@ chksum-md5 = "0.0.0"
getset = "0.1.2"
serde = { version = "1.0.197", optional = true, features = ["derive"] }
serde_json = "1.0.114"
tracing = "0.1.40"
zip = { version = "1.1.1", default-features = false, features = ["deflate", "time"], optional = true }

View File

@ -47,12 +47,16 @@ impl Function {
}
/// Compile the function into a virtual file.
#[must_use]
#[tracing::instrument(level = "trace", skip_all)]
pub fn compile(
&self,
options: &CompileOptions,
global_state: &MutCompilerState,
function_state: &FunctionCompilerState,
) -> VFile {
tracing::trace!("Compiling function '{}'", self.name);
let content = self
.commands
.iter()

View File

@ -106,7 +106,10 @@ impl Datapack {
/// Compile the pack into a virtual folder.
#[must_use]
#[tracing::instrument(level = "debug", skip(self))]
pub fn compile(&self, options: &CompileOptions) -> VFolder {
tracing::debug!("Compiling datapack: {:?}", self);
let compiler_state = Mutex::new(CompilerState::default());
let mut root_folder = self.custom_files.clone();

View File

@ -79,7 +79,10 @@ impl Namespace {
}
/// Compile the namespace into a virtual folder.
#[tracing::instrument(level = "debug", skip_all)]
pub fn compile(&self, options: &CompileOptions, state: &MutCompilerState) -> VFolder {
tracing::debug!("Compiling namespace");
let mut root_folder = VFolder::new();
// Compile functions