Skip to content

Commit 8b0a016

Browse files
committed
add parse_rule_config fail log
1 parent 45fbc8b commit 8b0a016

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

plugins/wasm-rust/src/rule_matcher.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
use crate::error::WasmRustError;
1616
use crate::internal::{get_http_request_header, get_property};
1717
use crate::log::Log;
18-
#[cfg(not(test))]
19-
use proxy_wasm::hostcalls::log;
2018
use proxy_wasm::traits::RootContext;
21-
#[cfg(not(test))]
22-
use proxy_wasm::types::LogLevel;
2319
use serde::de::DeserializeOwned;
2420
use serde_json::{from_slice, Map, Value};
2521
use std::borrow::Borrow;
@@ -111,15 +107,6 @@ where
111107
self.global_config = Some(Rc::new(plugin_config));
112108
}
113109
Err(err) => {
114-
#[cfg(not(test))]
115-
{
116-
log(
117-
LogLevel::Warn,
118-
format!("parse global config failed, err:{:?}", err).as_str(),
119-
)
120-
.unwrap();
121-
}
122-
123110
global_config_error = WasmRustError::new(err.to_string());
124111
}
125112
}
@@ -349,7 +336,12 @@ pub fn on_configure<RC: RootContext, PluginConfig: Default + DeserializeOwned>(
349336
Ok(value) => value,
350337
};
351338

352-
rule_matcher.parse_rule_config(&value).is_ok()
339+
if let Err(err) = rule_matcher.parse_rule_config(&value){
340+
log.error(format!("parse_rule_config fail {}", err).as_str());
341+
false
342+
}else{
343+
true
344+
}
353345
}
354346

355347
#[cfg(test)]

0 commit comments

Comments
 (0)