smart-house-web: в работе

This commit is contained in:
4 changed files with 58 additions and 6 deletions

View File

@@ -1,3 +1,8 @@
const CODE_LOGGER_INITIALIZATION_ERROR: i32 = 1;
const CODE_TOKIO_RUNTIME_CREATION_ERROR: i32 = 2;
const CODE_LISTENER_BINDING_ERROR: i32 = 3;
const CODE_STARTIG_SERVER_ERROR: i32 = 4;
pub fn init_logger() {
use tracing_subscriber::{Layer, layer::SubscriberExt, util::SubscriberInitExt};
@@ -9,8 +14,11 @@ pub fn init_logger() {
.boxed();
if let Err(e) = tracing_subscriber::registry().with(vec![layer]).try_init() {
eprintln!("Logger initialization failed: {:?}", e);
std::process::exit(1);
std::process::exit(CODE_LOGGER_INITIALIZATION_ERROR);
} else {
tracing::trace!("Logger succesfully initialized");
}
}
mod server;
pub use server::run_server;