aboutsummaryrefslogtreecommitdiffstats
path: root/mumd/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mumd/src/main.rs')
-rw-r--r--mumd/src/main.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/mumd/src/main.rs b/mumd/src/main.rs
index afc1b2e..fcffb87 100644
--- a/mumd/src/main.rs
+++ b/mumd/src/main.rs
@@ -8,9 +8,11 @@ use crate::state::Server;
use argparse::ArgumentParser;
use argparse::Store;
use argparse::StoreTrue;
+use colored::*;
use cpal::traits::StreamTrait;
use futures::channel::oneshot;
use futures::join;
+use log::*;
use mumble_protocol::crypt::ClientCryptState;
use std::net::ToSocketAddrs;
use std::sync::Arc;
@@ -18,6 +20,28 @@ use std::sync::Mutex;
#[tokio::main]
async fn main() {
+ // setup logger
+ fern::Dispatch::new()
+ .format(|out, message, record| {
+ out.finish(format_args!(
+ "{} {}:{} {}",
+ //TODO runtime flag that disables color
+ match record.level() {
+ Level::Error => "ERROR".red(),
+ Level::Warn => "WARN ".yellow(),
+ Level::Info => "INFO ".normal(),
+ Level::Debug => "DEBUG".green(),
+ Level::Trace => "TRACE".normal(),
+ },
+ record.file().unwrap(),
+ record.line().unwrap(),
+ message
+ ))
+ })
+ .level(log::LevelFilter::Debug)
+ .chain(std::io::stderr())
+ .apply().unwrap();
+
// Handle command line arguments
let mut server_host = "".to_string();
let mut server_port = 64738u16;