Integrate tracing (#6339)

Tracing Integration
- [reference](5bbf1859e9/projects/project-ideas.md (L297))


  - [x] replace slog & log with tracing throughout the codebase
- [x] implement custom crit log
- [x] make relevant changes in the formatter
- [x] replace sloggers
- [x] re-write SSE logging components

cc: @macladson @eserilev
This commit is contained in:
ThreeHrSleep
2025-03-13 04:01:05 +05:30
committed by GitHub
parent f23f984f85
commit d60c24ef1c
241 changed files with 9485 additions and 9328 deletions

View File

@@ -5,10 +5,10 @@
use anyhow::{bail, Context, Error};
use igd_next::{aio::tokio as igd, PortMappingProtocol};
use slog::debug;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::time::Duration;
use tokio::time::sleep;
use tracing::debug;
/// The duration in seconds of a port mapping on the gateway.
const MAPPING_DURATION: u32 = 3600;
@@ -17,11 +17,7 @@ const MAPPING_DURATION: u32 = 3600;
const MAPPING_TIMEOUT: u64 = MAPPING_DURATION as u64 / 2;
/// Attempts to map Discovery external port mappings with UPnP.
pub async fn construct_upnp_mappings(
addr: Ipv4Addr,
port: u16,
log: slog::Logger,
) -> Result<(), Error> {
pub async fn construct_upnp_mappings(addr: Ipv4Addr, port: u16) -> Result<(), Error> {
let gateway = igd::search_gateway(Default::default())
.await
.context("Gateway does not support UPnP")?;
@@ -54,7 +50,7 @@ pub async fn construct_upnp_mappings(
)
.await
.with_context(|| format!("Could not UPnP map port: {} on the gateway", port))?;
debug!(log, "Discovery UPnP port mapped"; "port" => %port);
debug!(%port,"Discovery UPnP port mapped");
sleep(Duration::from_secs(MAPPING_TIMEOUT)).await;
}
}