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

@@ -8,6 +8,8 @@ edition = "2021"
[dependencies]
common = { path = "../common" }
tokio = { version = "1", features = ["full"] }
env_logger = "0.10"
log = "0.4"
# warp = "0.3"
# aes-gcm = "0.10"
# procfs = "0.15"

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(())
}