refactor: Add logger

This commit is contained in:
Kevin Yue
2023-05-23 14:30:20 +08:00
parent cbd8b0f144
commit 462428f99a
15 changed files with 430 additions and 91 deletions

View File

@@ -2,6 +2,8 @@ include!(concat!(env!("OUT_DIR"), "/client_hash.rs"));
// use aes_gcm::{aead::OsRng, Aes256Gcm, KeyInit};
use common::{server, SOCKET_PATH};
use env_logger::Env;
use log::error;
use tokio::signal;
// static mut HTTP_PORT: u16 = 0;
@@ -96,6 +98,8 @@ use tokio::signal;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
// println!("{GPCLIENT_HASH}");
// unsafe {
@@ -107,7 +111,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// server::start().await
if let Err(err) = server::run(SOCKET_PATH, signal::ctrl_c()).await {
println!("Error starting the server: {err}");
error!("Error running server: {}", err);
}
Ok(())
}