Skip to content

Commit

Permalink
chore: add trace LogLevel. Update incoming request logs with full par…
Browse files Browse the repository at this point in the history
…ams to Trace. Fix unit test.
  • Loading branch information
MexicanAce committed Sep 18, 2023
1 parent 67d0bac commit 91d373e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/logging_middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Middleware<Meta> for LoggingMiddleware {
{
if let Request::Single(Call::MethodCall(method_call)) = &request {
match self.log_level_filter {
LevelFilter::Debug => {
LevelFilter::Trace => {
let full_params = match &method_call.params {
Params::Array(values) => {
if values.is_empty() {
Expand All @@ -47,7 +47,7 @@ impl Middleware<Meta> for LoggingMiddleware {
_ => String::default(),
};

log::debug!("{} was called {}", method_call.method.cyan(), full_params);
log::trace!("{} was called {}", method_call.method.cyan(), full_params);
}
_ => {
// Generate truncated params for requests with massive payloads
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ async fn build_json_http<
/// Log filter level for the node.
#[derive(Debug, Clone, ValueEnum)]
enum LogLevel {
Trace,
Debug,
Info,
Warn,
Expand All @@ -158,6 +159,7 @@ enum LogLevel {
impl From<LogLevel> for LevelFilter {
fn from(value: LogLevel) -> Self {
match value {
LogLevel::Trace => LevelFilter::Trace,
LogLevel::Debug => LevelFilter::Debug,
LogLevel::Info => LevelFilter::Info,
LogLevel::Warn => LevelFilter::Warn,
Expand Down
26 changes: 1 addition & 25 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2120,31 +2120,7 @@ mod tests {
async fn test_get_fee_history_with_multiple_blocks() {
// Arrange
let node = InMemoryNode::<HttpForkSource>::default();

let private_key = H256::random();
let from_account = PackedEthSignature::address_from_private_key(&private_key)
.expect("failed generating address");
node.set_rich_account(from_account);
let mut tx = L2Tx::new_signed(
Address::random(),
vec![],
Nonce(0),
Fee {
gas_limit: U256::from(1_000_000),
max_fee_per_gas: U256::from(250_000_000),
max_priority_fee_per_gas: U256::from(250_000_000),
gas_per_pubdata_limit: U256::from(20000),
},
U256::from(1),
L2ChainId(260),
&private_key,
None,
Default::default(),
)
.unwrap();
tx.set_input(vec![], H256::repeat_byte(0x01));

node.apply_txs(vec![tx]).expect("failed applying tx");
testing::apply_tx(&node, H256::repeat_byte(0x01));

// Act
let fee_history = node
Expand Down

0 comments on commit 91d373e

Please sign in to comment.