more cleanup
This commit is contained in:
@@ -24,7 +24,6 @@ pub fn rpc_error_protocol<T: AsRef<str>>(x: T) -> RPCError {
|
||||
}
|
||||
pub fn rpc_error_capnp_error(e: capnp::Error) -> RPCError {
|
||||
error!("RPCError Protocol: capnp error: {}", &e.description);
|
||||
panic!("wtf");
|
||||
RPCError::Protocol(e.description)
|
||||
}
|
||||
pub fn rpc_error_capnp_notinschema(e: capnp::NotInSchema) -> RPCError {
|
||||
|
@@ -290,7 +290,6 @@ pub async fn test_config() {
|
||||
let inner = vc.get();
|
||||
assert_eq!(inner.program_name, String::from("Veilid"));
|
||||
assert_eq!(inner.namespace, String::from(""));
|
||||
assert_eq!(inner.api_log_level, VeilidConfigLogLevel::Off);
|
||||
assert_eq!(inner.capabilities.protocol_udp, true);
|
||||
assert_eq!(inner.capabilities.protocol_connect_tcp, true);
|
||||
assert_eq!(inner.capabilities.protocol_accept_tcp, true);
|
||||
|
@@ -23,7 +23,6 @@ pub use network_manager::NetworkManager;
|
||||
pub use routing_table::RoutingTable;
|
||||
pub use rpc_processor::StatusAnswer;
|
||||
|
||||
use api_tracing_layer::*;
|
||||
use core::fmt;
|
||||
use core_context::{api_shutdown, VeilidCoreContext};
|
||||
use enumset::*;
|
||||
|
@@ -1,7 +1,9 @@
|
||||
use super::*;
|
||||
use core::fmt::Debug;
|
||||
|
||||
#[instrument(level = "trace", ret, err)]
|
||||
// XXX: Don't trace these functions as they are used in the transfer of API logs, which will recurse!
|
||||
|
||||
// #[instrument(level = "trace", ret, err)]
|
||||
pub fn deserialize_json<'a, T: de::Deserialize<'a> + Debug>(
|
||||
arg: &'a str,
|
||||
) -> Result<T, VeilidAPIError> {
|
||||
@@ -15,7 +17,7 @@ pub fn deserialize_json<'a, T: de::Deserialize<'a> + Debug>(
|
||||
})
|
||||
}
|
||||
|
||||
#[instrument(level = "trace", ret, err)]
|
||||
// #[instrument(level = "trace", ret, err)]
|
||||
pub fn deserialize_opt_json<T: de::DeserializeOwned + Debug>(
|
||||
arg: Option<String>,
|
||||
) -> Result<T, VeilidAPIError> {
|
||||
@@ -29,7 +31,7 @@ pub fn deserialize_opt_json<T: de::DeserializeOwned + Debug>(
|
||||
deserialize_json(arg)
|
||||
}
|
||||
|
||||
#[instrument(level = "trace", ret)]
|
||||
// #[instrument(level = "trace", ret)]
|
||||
pub fn serialize_json<T: Serialize + Debug>(val: T) -> String {
|
||||
match serde_json::to_string(&val) {
|
||||
Ok(v) => v,
|
||||
|
@@ -244,7 +244,6 @@ impl Default for VeilidConfigLogLevel {
|
||||
pub struct VeilidConfigInner {
|
||||
pub program_name: String,
|
||||
pub namespace: String,
|
||||
pub api_log_level: VeilidConfigLogLevel,
|
||||
pub capabilities: VeilidConfigCapabilities,
|
||||
pub protected_store: VeilidConfigProtectedStore,
|
||||
pub table_store: VeilidConfigTableStore,
|
||||
@@ -309,7 +308,6 @@ impl VeilidConfig {
|
||||
let mut inner = self.inner.write();
|
||||
get_config!(inner.program_name);
|
||||
get_config!(inner.namespace);
|
||||
get_config!(inner.api_log_level);
|
||||
get_config!(inner.capabilities.protocol_udp);
|
||||
get_config!(inner.capabilities.protocol_connect_tcp);
|
||||
get_config!(inner.capabilities.protocol_accept_tcp);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use super::*;
|
||||
use crate::xx::*;
|
||||
use tracing::level_filters::LevelFilter;
|
||||
use tracing::subscriber;
|
||||
use tracing::subscriber::Interest;
|
||||
use tracing_subscriber::layer;
|
||||
|
||||
struct VeilidLayerFilterInner {
|
||||
@@ -54,33 +54,35 @@ impl VeilidLayerFilter {
|
||||
}
|
||||
callsite::rebuild_interest_cache();
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: tracing::Subscriber> layer::Filter<S> for VeilidLayerFilter {
|
||||
fn enabled(&self, metadata: &tracing::Metadata<'_>, _: &layer::Context<'_, S>) -> bool {
|
||||
fn interesting(&self, metadata: &tracing::Metadata<'_>) -> bool {
|
||||
let inner = self.inner.read();
|
||||
|
||||
if *metadata.level() > inner.max_level {
|
||||
false
|
||||
} else {
|
||||
true
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
fn callsite_enabled(
|
||||
&self,
|
||||
metadata: &'static tracing::Metadata<'static>,
|
||||
) -> subscriber::Interest {
|
||||
let inner = self.inner.read();
|
||||
let skip = inner
|
||||
.ignore_list
|
||||
.iter()
|
||||
.any(|v| metadata.target().starts_with(&**v));
|
||||
if skip {
|
||||
subscriber::Interest::never()
|
||||
} else if *metadata.level() > inner.max_level {
|
||||
subscriber::Interest::never()
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: tracing::Subscriber> layer::Filter<S> for VeilidLayerFilter {
|
||||
fn enabled(&self, metadata: &tracing::Metadata<'_>, _: &layer::Context<'_, S>) -> bool {
|
||||
self.interesting(metadata)
|
||||
}
|
||||
|
||||
fn callsite_enabled(&self, metadata: &'static tracing::Metadata<'static>) -> Interest {
|
||||
if self.interesting(metadata) {
|
||||
Interest::always()
|
||||
} else {
|
||||
subscriber::Interest::always()
|
||||
Interest::never()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user