mirror of
https://github.com/zaphar/durnitisp.git
synced 2025-07-22 18:19:48 -04:00
logging: sprinkle some debug logs throughout
This commit is contained in:
parent
35914251bf
commit
c4a069f246
12
src/main.rs
12
src/main.rs
@ -25,7 +25,7 @@ use prometheus;
|
||||
use prometheus::{CounterVec, Encoder, IntGaugeVec, Opts, Registry, TextEncoder};
|
||||
use tiny_http;
|
||||
|
||||
use log::{error, info};
|
||||
use log::{debug, error, info};
|
||||
|
||||
gflags::define! {
|
||||
/// Print this help text.
|
||||
@ -47,6 +47,11 @@ gflags::define! {
|
||||
--stunRecvTimeoutSecs: u64 = 5
|
||||
}
|
||||
|
||||
gflags::define! {
|
||||
/// Enable debug logging
|
||||
--debug = false
|
||||
}
|
||||
|
||||
const STUN_PAYLOAD: [u8; 20] = [
|
||||
0, 1, // Binding request
|
||||
0, 0, // Message length
|
||||
@ -119,7 +124,8 @@ fn main() -> anyhow::Result<()> {
|
||||
gflags::print_help_and_exit(0);
|
||||
}
|
||||
|
||||
stderrlog::new().verbosity(2).init()?;
|
||||
let level = if DEBUG.flag { 3 } else { 2 };
|
||||
stderrlog::new().verbosity(level).init()?;
|
||||
|
||||
if stun_servers.is_empty() {
|
||||
stun_servers = default_stun_servers;
|
||||
@ -152,6 +158,7 @@ fn main() -> anyhow::Result<()> {
|
||||
let s = s.clone();
|
||||
let domain_name = *stun_servers_copy.get(i).unwrap();
|
||||
let connect_thread = thread::Pending::new(move || {
|
||||
debug!("started thread for {}", domain_name);
|
||||
loop {
|
||||
let now = SystemTime::now();
|
||||
info!("Attempting to connect to {}", domain_name);
|
||||
@ -197,6 +204,7 @@ fn main() -> anyhow::Result<()> {
|
||||
parent.schedule(Box::new(connect_thread));
|
||||
}
|
||||
let render_thread = thread::Pending::new(move || {
|
||||
debug!("attempting to start server on {}", LISTENHOST.flag);
|
||||
let server = tiny_http::Server::http(LISTENHOST.flag).unwrap();
|
||||
loop {
|
||||
info!("Waiting for request");
|
||||
|
Loading…
x
Reference in New Issue
Block a user