clean up logging
This commit is contained in:
parent
a5644b42e1
commit
64ec4ee592
1 changed files with 8 additions and 13 deletions
21
src/main.rs
21
src/main.rs
|
@ -1,32 +1,27 @@
|
|||
#![feature(slice_as_array)]
|
||||
|
||||
use frontend::App;
|
||||
use joecalsend::{Config, error, error::LocalSendError, models::Device};
|
||||
use joecalsend::{Config, error, models::Device};
|
||||
use local_ip_address::local_ip;
|
||||
use network_interface::{Addr, NetworkInterface, NetworkInterfaceConfig, V4IfAddr};
|
||||
use tui_logger::{
|
||||
LevelFilter, TuiLoggerFile, TuiLoggerLevelOutput, init_logger, set_default_level, set_log_file,
|
||||
};
|
||||
use tui_logger::{LevelFilter, init_logger, set_env_filter_from_env};
|
||||
|
||||
mod frontend;
|
||||
|
||||
fn main() -> error::Result<()> {
|
||||
let device = Device::default();
|
||||
dbg!(&device);
|
||||
|
||||
let std::net::IpAddr::V4(ip) = local_ip()? else {
|
||||
unreachable!()
|
||||
};
|
||||
|
||||
if std::env::var("RUST_LOG").is_err() {
|
||||
unsafe {
|
||||
std::env::set_var("RUST_LOG", "joecalsend");
|
||||
}
|
||||
}
|
||||
init_logger(LevelFilter::Debug).map_err(|e| std::io::Error::other(format!("{e}")))?;
|
||||
set_default_level(LevelFilter::Debug);
|
||||
// let mut logfile = std::env::temp_dir();
|
||||
// logfile.push("joecalsend.log");
|
||||
// let file_options = TuiLoggerFile::new(logfile.to_str().unwrap())
|
||||
// .output_level(Some(TuiLoggerLevelOutput::Abbreviated))
|
||||
// .output_file(false)
|
||||
// .output_separator(':');
|
||||
// set_log_file(file_options);
|
||||
set_env_filter_from_env(None);
|
||||
|
||||
// for enumerating subnet peers when multicast fails (https://github.com/localsend/protocol?tab=readme-ov-file#32-http-legacy-mode)
|
||||
let mut _network_ip = ip;
|
||||
|
|
Loading…
Reference in a new issue