feat: add logging
This commit is contained in:
@@ -45,6 +45,8 @@ pub mod utils;
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args = args::Args::parse();
|
||||
#[cfg(feature = "log")]
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
let conf = if let Some(conf) = File::try_open(&args.conf) {
|
||||
conf::Config::from_toml_file(&mut conf?)?
|
||||
} else {
|
||||
|
||||
@@ -38,6 +38,9 @@ pub async fn start_app(args: crate::args::Args, config: crate::conf::Config) ->
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.app_data(app)
|
||||
.wrap(actix_web::middleware::Logger::new(
|
||||
"%a (%{r}a) %r -> %s, %b B in %T s",
|
||||
))
|
||||
.service(services::images::make_scope(ws::IMAGES))
|
||||
.default_service(web::to(services::not_found::not_found))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user