Merge pull request #217 from junkurihara/fix/log-level

Fix: log level
This commit is contained in:
Jun Kurihara 2024-11-06 02:26:26 +09:00 committed by GitHub
commit c8ccf8fd1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 17 additions and 15 deletions

View file

@ -28,7 +28,7 @@ rustls = { version = "0.23.16", default-features = false, features = [
"std", "std",
"aws_lc_rs", "aws_lc_rs",
] } ] }
rustls-platform-verifier = { version = "0.3.4" } rustls-platform-verifier = { version = "0.4.0" }
rustls-acme = { path = "../submodules/rustls-acme/", default-features = false, features = [ rustls-acme = { path = "../submodules/rustls-acme/", default-features = false, features = [
"aws-lc-rs", "aws-lc-rs",
] } ] }

View file

@ -49,7 +49,7 @@ futures-util = { version = "0.3.31", default-features = false }
# config # config
clap = { version = "4.5.20", features = ["std", "cargo", "wrap_help"] } clap = { version = "4.5.20", features = ["std", "cargo", "wrap_help"] }
toml = { version = "0.8.19", default-features = false, features = ["parse"] } toml = { version = "0.8.19", default-features = false, features = ["parse"] }
hot_reload = "0.1.6" hot_reload = "0.1.8"
serde_ignored = "0.1.10" serde_ignored = "0.1.10"
# logging # logging

View file

@ -8,17 +8,16 @@ pub struct ConfigTomlReloader {
} }
#[async_trait] #[async_trait]
impl Reload<ConfigToml> for ConfigTomlReloader { impl Reload<ConfigToml, String> for ConfigTomlReloader {
type Source = String; type Source = String;
async fn new(source: &Self::Source) -> Result<Self, ReloaderError<ConfigToml>> { async fn new(source: &Self::Source) -> Result<Self, ReloaderError<ConfigToml, String>> {
Ok(Self { Ok(Self {
config_path: source.clone(), config_path: source.clone(),
}) })
} }
async fn reload(&self) -> Result<Option<ConfigToml>, ReloaderError<ConfigToml>> { async fn reload(&self) -> Result<Option<ConfigToml>, ReloaderError<ConfigToml, String>> {
let conf = ConfigToml::new(&self.config_path) let conf = ConfigToml::new(&self.config_path).map_err(|e| ReloaderError::<ConfigToml, String>::Reload(e.to_string()))?;
.map_err(|_e| ReloaderError::<ConfigToml>::Reload("Failed to reload config toml"))?;
Ok(Some(conf)) Ok(Some(conf))
} }
} }

View file

@ -21,7 +21,7 @@ pub fn init_logger() {
.target() .target()
.starts_with(env!("CARGO_PKG_NAME").replace('-', "_").as_str()) .starts_with(env!("CARGO_PKG_NAME").replace('-', "_").as_str())
&& metadata.level() <= &level) && metadata.level() <= &level)
|| metadata.level() <= &tracing::Level::ERROR.min(level) || metadata.level() <= &tracing::Level::WARN.min(level)
})); }));
tracing_subscriber::registry().with(stdio_layer).init(); tracing_subscriber::registry().with(stdio_layer).init();
} else { } else {

View file

@ -40,8 +40,11 @@ fn main() {
std::process::exit(1); std::process::exit(1);
} }
} else { } else {
let (config_service, config_rx) = let (config_service, config_rx) = ReloaderService::<ConfigTomlReloader, ConfigToml, String>::new(
ReloaderService::<ConfigTomlReloader, ConfigToml>::new(&parsed_opts.config_file_path, CONFIG_WATCH_DELAY_SECS, false) &parsed_opts.config_file_path,
CONFIG_WATCH_DELAY_SECS,
false,
)
.await .await
.unwrap(); .unwrap();
@ -246,7 +249,7 @@ async fn rpxy_service_without_watcher(
} }
async fn rpxy_service_with_watcher( async fn rpxy_service_with_watcher(
mut config_rx: ReloaderReceiver<ConfigToml>, mut config_rx: ReloaderReceiver<ConfigToml, String>,
runtime_handle: tokio::runtime::Handle, runtime_handle: tokio::runtime::Handle,
) -> Result<(), anyhow::Error> { ) -> Result<(), anyhow::Error> {
info!("Start rpxy service with dynamic config reloader"); info!("Start rpxy service with dynamic config reloader");

View file

@ -20,7 +20,7 @@ rustc-hash = { version = "2.0.0" }
tracing = { version = "0.1.40" } tracing = { version = "0.1.40" }
derive_builder = { version = "0.20.2" } derive_builder = { version = "0.20.2" }
thiserror = { version = "1.0.68" } thiserror = { version = "1.0.68" }
hot_reload = { version = "0.1.6" } hot_reload = { version = "0.1.8" }
async-trait = { version = "0.1.83" } async-trait = { version = "0.1.83" }
rustls = { version = "0.23.16", default-features = false, features = [ rustls = { version = "0.23.16", default-features = false, features = [
"std", "std",

View file

@ -79,7 +79,7 @@ hyper-rustls = { version = "0.27.3", default-features = false, features = [
# tls and cert management for server # tls and cert management for server
rpxy-certs = { path = "../rpxy-certs/", default-features = false } rpxy-certs = { path = "../rpxy-certs/", default-features = false }
hot_reload = "0.1.6" hot_reload = "0.1.8"
rustls = { version = "0.23.16", default-features = false } rustls = { version = "0.23.16", default-features = false }
rustls-post-quantum = { version = "0.1.0", optional = true } rustls-post-quantum = { version = "0.1.0", optional = true }
tokio-rustls = { version = "0.26.0", features = ["early-data"] } tokio-rustls = { version = "0.26.0", features = ["early-data"] }