feat(server): Add stub for server start command

This commit is contained in:
Paul Campbell 2024-04-06 18:53:18 +01:00
parent 4a0e0fdfa5
commit e25ff500d8

View file

@ -1,5 +1,7 @@
use std::io::Write;
use tracing::info;
pub(crate) fn init() {
let file_name = "git-next-server.toml";
let path = std::path::Path::new(file_name);
@ -20,3 +22,29 @@ pub(crate) fn init() {
}
}
}
pub(crate) fn start() {
let Ok(_) = init_logging() else {
eprintln!("Failed to initialize logging.");
return;
};
info!("Starting Server...");
// todo!()
}
pub fn init_logging() -> Result<(), tracing::subscriber::SetGlobalDefaultError> {
use tracing_subscriber::prelude::*;
let console_layer = console_subscriber::ConsoleLayer::builder().spawn();
let subscriber = tracing_subscriber::fmt::layer()
// NOTE: set RUSTLOG in ${root}/.cargo/config
.with_target(false)
.with_file(true)
.with_line_number(true);
tracing_subscriber::registry()
.with(console_layer)
.with(subscriber)
.init();
Ok(())
}