fix(main): add more logging and default to info #31
4 changed files with 16 additions and 6 deletions
|
@ -2,6 +2,12 @@
|
|||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.3.4] - 2024-12-26
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(main)* Add more logging and default to info
|
||||
|
||||
## [0.3.3] - 2024-12-22
|
||||
|
||||
### 🚀 Features
|
||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1139,7 +1139,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|||
|
||||
[[package]]
|
||||
name = "webnsupdate"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"axum-client-ip",
|
||||
|
|
|
@ -3,7 +3,7 @@ cargo-features = ["codegen-backend"]
|
|||
[package]
|
||||
description = "An HTTP server using HTTP basic auth to make secure calls to nsupdate"
|
||||
name = "webnsupdate"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
edition = "2021"
|
||||
license-file = "LICENSE"
|
||||
readme = "README.md"
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -26,7 +26,7 @@ const DEFAULT_SALT: &str = "UpdateMyDNS";
|
|||
#[derive(Debug, Parser)]
|
||||
struct Opts {
|
||||
#[command(flatten)]
|
||||
verbosity: Verbosity<clap_verbosity_flag::WarnLevel>,
|
||||
verbosity: Verbosity<clap_verbosity_flag::InfoLevel>,
|
||||
|
||||
/// Ip address of the server
|
||||
#[arg(long, default_value = "127.0.0.1")]
|
||||
|
@ -188,6 +188,7 @@ fn load_ip(path: &Path) -> Result<Option<IpAddr>> {
|
|||
))
|
||||
}
|
||||
|
||||
#[tracing::instrument(err)]
|
||||
fn main() -> Result<()> {
|
||||
// set panic hook to pretty print with miette's formatter
|
||||
miette::set_panic_hook();
|
||||
|
@ -204,9 +205,10 @@ fn main() -> Result<()> {
|
|||
.from_env_lossy(),
|
||||
)
|
||||
.finish();
|
||||
|
||||
tracing::subscriber::set_global_default(subscriber)
|
||||
.into_diagnostic()
|
||||
.wrap_err("setting global tracing subscriber")?;
|
||||
.wrap_err("failed to set global tracing subscriber")?;
|
||||
|
||||
debug!("{args:?}");
|
||||
|
||||
|
@ -249,7 +251,8 @@ fn main() -> Result<()> {
|
|||
|
||||
Ok(pass)
|
||||
})
|
||||
.transpose()?;
|
||||
.transpose()
|
||||
.wrap_err("failed to load password hash")?;
|
||||
|
||||
ensure!(
|
||||
password_hash.is_some() || insecure,
|
||||
|
@ -283,7 +286,7 @@ fn main() -> Result<()> {
|
|||
}
|
||||
Ok(None) => info!("No previous IP address set"),
|
||||
|
||||
Err(err) => error!("Failed to load last ip address: {err}"),
|
||||
Err(err) => error!("Ignoring previous IP due to: {err}"),
|
||||
};
|
||||
|
||||
// Create services
|
||||
|
@ -310,6 +313,7 @@ fn main() -> Result<()> {
|
|||
.await
|
||||
.into_diagnostic()
|
||||
})
|
||||
.wrap_err("failed to run main loop")
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(state), level = "trace", ret(level = "info"))]
|
||||
|
|
Loading…
Reference in a new issue