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)]
|
#![feature(slice_as_array)]
|
||||||
|
|
||||||
use frontend::App;
|
use frontend::App;
|
||||||
use joecalsend::{Config, error, error::LocalSendError, models::Device};
|
use joecalsend::{Config, error, models::Device};
|
||||||
use local_ip_address::local_ip;
|
use local_ip_address::local_ip;
|
||||||
use network_interface::{Addr, NetworkInterface, NetworkInterfaceConfig, V4IfAddr};
|
use network_interface::{Addr, NetworkInterface, NetworkInterfaceConfig, V4IfAddr};
|
||||||
use tui_logger::{
|
use tui_logger::{LevelFilter, init_logger, set_env_filter_from_env};
|
||||||
LevelFilter, TuiLoggerFile, TuiLoggerLevelOutput, init_logger, set_default_level, set_log_file,
|
|
||||||
};
|
|
||||||
|
|
||||||
mod frontend;
|
mod frontend;
|
||||||
|
|
||||||
fn main() -> error::Result<()> {
|
fn main() -> error::Result<()> {
|
||||||
let device = Device::default();
|
let device = Device::default();
|
||||||
dbg!(&device);
|
|
||||||
|
|
||||||
let std::net::IpAddr::V4(ip) = local_ip()? else {
|
let std::net::IpAddr::V4(ip) = local_ip()? else {
|
||||||
unreachable!()
|
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}")))?;
|
init_logger(LevelFilter::Debug).map_err(|e| std::io::Error::other(format!("{e}")))?;
|
||||||
set_default_level(LevelFilter::Debug);
|
set_env_filter_from_env(None);
|
||||||
// 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);
|
|
||||||
|
|
||||||
// for enumerating subnet peers when multicast fails (https://github.com/localsend/protocol?tab=readme-ov-file#32-http-legacy-mode)
|
// 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;
|
let mut _network_ip = ip;
|
||||||
|
|
Loading…
Reference in a new issue