use std::fmt;
use std::borrow::BorrowMut;
use std::sync::{Arc, Mutex};
+use log::LevelFilter;
use num_traits::Zero;
use num_traits::cast::AsPrimitive;
use percent_encoding::percent_decode_str;
-use actix_web::{get, web, App, HttpServer, HttpRequest, HttpResponse, Responder, ResponseError, Result};
+use actix_web::{middleware::Logger, get, web, App, HttpServer, HttpRequest, HttpResponse, Responder, ResponseError, Result};
use actix_web::body::BoxBody;
use actix_web::http::StatusCode;
use image::{ImageBuffer, ColorType, Rgb, RgbImage, write_buffer_with_format};
#[actix_web::main] // or #[tokio::main]
async fn main() -> std::io::Result<()> {
- env_logger::init();
+ env_logger::builder()
+ .filter_module("actix_web", LevelFilter::Info)
+ .parse_default_env()
+ .init();
+
let listenaddress = env::args().nth(1).unwrap_or_else(|| "127.0.0.1:8080".to_string());
let canvas0 = Arc::new(Mutex::new(Canvas0(Some(Canvas::new(32, 32)))));
let canvas1 = Arc::new(Mutex::new(Canvas1(None)));
let canvas2 = Arc::new(Mutex::new(Canvas2(None)));
+
HttpServer::new(move || {
App::new()
+ .wrap(Logger::default())
.service(greet)
.service(img_gen0)
.service(img_gen1)