smart-house-web: в работе
smart-house-web: в работе
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/.idea/
|
||||
/**/.DS_Store
|
||||
/tmp/
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[package]
|
||||
name = "smart-house-web"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = ["backend"]
|
||||
|
||||
[dependencies]
|
||||
[workspace.dependencies]
|
||||
|
||||
9
smart-house-web/backend/Cargo.toml
Normal file
9
smart-house-web/backend/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "backend"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
axum = "0.8.9"
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = "0.3.23"
|
||||
16
smart-house-web/backend/src/lib.rs
Normal file
16
smart-house-web/backend/src/lib.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
pub fn init_logger() {
|
||||
use tracing_subscriber::{Layer, layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
let layer = tracing_subscriber::fmt::layer()
|
||||
.with_thread_names(true)
|
||||
.with_file(false)
|
||||
.with_line_number(false)
|
||||
.compact()
|
||||
.boxed();
|
||||
if let Err(e) = tracing_subscriber::registry().with(vec![layer]).try_init() {
|
||||
eprintln!("Logger initialization failed: {:?}", e);
|
||||
std::process::exit(1);
|
||||
} else {
|
||||
tracing::trace!("Logger succesfully initialized");
|
||||
}
|
||||
}
|
||||
6
smart-house-web/backend/src/main.rs
Normal file
6
smart-house-web/backend/src/main.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use backend::init_logger;
|
||||
|
||||
fn main() {
|
||||
init_logger();
|
||||
println!("Hello, world!");
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
Reference in New Issue
Block a user