Skip to content

Commit

Permalink
Cleaned up info level log messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidv1992 authored and rnijveld committed Sep 19, 2024
1 parent f46fd88 commit d33df7d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions ntp-proto/src/algorithm/kalman/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{collections::HashMap, fmt::Debug, hash::Hash, time::Duration};

use tracing::{error, info};
use tracing::{debug, error, info};

use crate::{
clock::NtpClock,
Expand Down Expand Up @@ -204,7 +204,7 @@ impl<C: NtpClock, SourceId: Hash + Eq + Copy + Debug> KalmanClockController<C, S
..next_update
}
} else {
info!("No consensus cluster found");
info!("No consensus on current time");
StateUpdate {
time_snapshot: Some(self.timedata),
..StateUpdate::default()
Expand Down Expand Up @@ -277,7 +277,7 @@ impl<C: NtpClock, SourceId: Hash + Eq + Copy + Debug> KalmanClockController<C, S
.slew_maximum_frequency_offset
.min(change.abs() / self.algo_config.slew_minimum_duration);
let duration = Duration::from_secs_f64(change.abs() / freq);
info!(
debug!(
"Slewing by {}ms over {}s",
change * 1e3,
duration.as_secs_f64(),
Expand Down Expand Up @@ -319,7 +319,7 @@ impl<C: NtpClock, SourceId: Hash + Eq + Copy + Debug> KalmanClockController<C, S
.process_frequency_steering(freq_update, actual_change, state.wander)
}
}
info!(
debug!(
"Changed frequency, current steer {}ppm, desired freq {}ppm",
self.freq_offset * 1e6,
self.desired_freq * 1e6,
Expand Down
6 changes: 3 additions & 3 deletions ntp-proto/src/algorithm/kalman/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
/// If they are often too small, v is quartered, and if they are often too
/// large, v is quadrupled (note, this corresponds with doubling/halving
/// the more intuitive standard deviation).
use tracing::{debug, info, trace};
use tracing::{debug, trace};

use crate::{
algorithm::{KalmanControllerMessage, KalmanSourceMessage, SourceController},
Expand Down Expand Up @@ -383,13 +383,13 @@ impl SourceFilter {
.desired_poll_interval
.inc(source_defaults_config.poll_interval_limits);
self.poll_score = 0;
info!(interval = ?self.desired_poll_interval, "Increased poll interval");
debug!(interval = ?self.desired_poll_interval, "Increased poll interval");
} else if self.poll_score >= algo_config.poll_interval_hysteresis {
self.desired_poll_interval = self
.desired_poll_interval
.dec(source_defaults_config.poll_interval_limits);
self.poll_score = 0;
info!(interval = ?self.desired_poll_interval, "Decreased poll interval");
debug!(interval = ?self.desired_poll_interval, "Decreased poll interval");
}
}

Expand Down
2 changes: 1 addition & 1 deletion ntp-proto/src/nts_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ impl KeyExchangeResultDecoder {
}
#[cfg(feature = "ntpv5")]
DraftId { .. } => {
tracing::warn!("Unexpected draft id");
tracing::debug!("Unexpected draft id");
Continue(state)
}
NewCookie { cookie_data } => {
Expand Down
16 changes: 8 additions & 8 deletions ntp-proto/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::{
net::{IpAddr, SocketAddr},
time::Duration,
};
use tracing::{debug, info, trace, warn};
use tracing::{debug, trace, warn};

const MAX_STRATUM: u8 = 16;
const POLL_WINDOW: std::time::Duration = std::time::Duration::from_secs(5);
Expand Down Expand Up @@ -208,7 +208,7 @@ impl NtpSourceSnapshot {
use AcceptSynchronizationError::*;

if self.stratum >= local_stratum {
info!(
debug!(
source_stratum = self.stratum,
own_stratum = local_stratum,
"Source rejected due to invalid stratum. The stratum of a source must be lower than the own stratum",
Expand All @@ -226,22 +226,22 @@ impl NtpSourceSnapshot {
.iter()
.any(|ip| ReferenceId::from_ip(*ip) == self.source_id)
{
info!("Source rejected because of detected synchronization loop (ref id)");
debug!("Source rejected because of detected synchronization loop (ref id)");
return Err(Loop);
}

#[cfg(feature = "ntpv5")]
match self.bloom_filter {
Some(filter) if filter.contains_id(&system.server_id) => {
info!("Source rejected because of detected synchronization loop (bloom filter)");
debug!("Source rejected because of detected synchronization loop (bloom filter)");
return Err(Loop);
}
_ => {}
}

// An unreachable error occurs if the server is unreachable.
if !self.reach.is_reachable() {
info!("Source is unreachable");
debug!("Source is unreachable");
return Err(ServerUnreachable);
}

Expand Down Expand Up @@ -636,10 +636,10 @@ impl<Controller: SourceController> NtpSource<Controller> {
if let ProtocolVersion::V4UpgradingToV5 { tries_left } = self.protocol_version {
let tries_left = tries_left.saturating_sub(1);
if message.is_upgrade() {
info!("Received a valid upgrade response, switching to NTPv5!");
debug!("Received a valid upgrade response, switching to NTPv5!");
self.protocol_version = ProtocolVersion::V5;
} else if tries_left == 0 {
info!("Server does not support NTPv5, stopping the upgrade process");
debug!("Server does not support NTPv5, stopping the upgrade process");
self.protocol_version = ProtocolVersion::V4;
} else {
debug!(tries_left, "Server did not yet respond with upgrade code");
Expand Down Expand Up @@ -750,7 +750,7 @@ impl<Controller: SourceController> NtpSource<Controller> {
.bloom_filter
.handle_response(header.client_cookie, ref_id);
if let Err(err) = result {
info!(?err, "Invalid ReferenceIdResponse from source, ignoring...")
warn!(?err, "Invalid ReferenceIdResponse from source, ignoring...")
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ntpd/src/daemon/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ where
let opt_interface_name: Option<InterfaceName> = Deserialize::deserialize(deserializer)?;

if let Some(interface_name) = opt_interface_name {
tracing::info!("using custom interface {}", interface_name);
tracing::debug!("using custom interface {}", interface_name);
} else {
tracing::info!("using default interface");
tracing::trace!("using default interface");
}

Ok(opt_interface_name)
Expand Down Expand Up @@ -390,7 +390,7 @@ impl Config {
info!("using config file at default location `{:?}`", global_path);
match Config::from_file(global_path).await {
Err(ConfigError::Io(e)) if e.kind() == ErrorKind::PermissionDenied => {
info!("permission denied on global config file! using default config ...");
warn!("permission denied on global config file! using default config ...");
}
other => {
return other;
Expand Down

0 comments on commit d33df7d

Please sign in to comment.