Skip to content

Commit

Permalink
Add FastWithNoLogs compiler profile
Browse files Browse the repository at this point in the history
  • Loading branch information
lrubasze committed Dec 19, 2024
1 parent 45bd944 commit bb4447c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scrypto-compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,12 +1326,17 @@ impl ScryptoCompilerBuilder {
self
}

pub fn log_level(&mut self, log_level: Level) -> &mut Self {
// Firstly clear any log level previously set
pub fn disable_logs(&mut self) -> &mut Self {
let all_features = ScryptoCompilerInputParams::log_level_to_scrypto_features(Level::Trace);
all_features.iter().for_each(|log_level| {
self.input_params.features.swap_remove(log_level);
});
self
}

pub fn log_level(&mut self, log_level: Level) -> &mut Self {
// Firstly clear any log level previously set
self.disable_logs();

// Now set log level provided by the user
if Level::Error <= log_level {
Expand Down
6 changes: 6 additions & 0 deletions scrypto-test/src/ledger_simulator/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub enum CompileProfile {
Fast,
/// Disables WASM optimization and enables all logs from error to trace level, by default used by Ledger Simulator.
FastWithTraceLogs,
/// Disables WASM optimization and disables all logs.
FastWithNoLogs,
}

pub struct Compile;
Expand Down Expand Up @@ -55,6 +57,10 @@ impl Compile {
compiler_builder.optimize_with_wasm_opt(None);
compiler_builder.log_level(Level::Trace); // all logs from error to trace
}
CompileProfile::FastWithNoLogs => {
compiler_builder.optimize_with_wasm_opt(None);
compiler_builder.disable_logs();
}
}

env_vars.iter().for_each(|(name, value)| {
Expand Down

0 comments on commit bb4447c

Please sign in to comment.