Integrating our logger into our servers
For our servers, they all follow the same template. We wrap the ActixLogger
in our server definition. All our servers should have a layout like the following:
. . .
use glue::logger::{
logger::init_logger,
network_wrappers::actix_web::ActixLogger
};
use actix_cors::Cors;
#[tokio::main]
async fn main() -> std::io::Result<()> {
init_logger();
run_migrations().await;
HttpServer::new(|| {
let cors = Cors::default().allow_any_origin()
.allow_any_method()
.allow_any_header();
App::new().wrap(ActixLogger)
.wrap(cors)
.configure(api::views_factory)
})
.workers(4)
.bind("127.0.0.1:8081")?
.run()
.await
}
Here we can see that we initialize the logger with the init_logger
function, and then carry on with the rest of the process. For the ingress we must run both migrations for both...