use rsrt::{cover, out};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};

const LOGS: &str = include_str!("../logs.txt");

fn main() {
	const WIDTH: usize = 1920;
	const HEIGHT: usize = 1080;

	tracing_subscriber::registry()
		.with(tracing_subscriber::fmt::layer())
		.with(tracing_subscriber::EnvFilter::from_default_env())
		.init();

	let per_pixel = LOGS.len() / (WIDTH * HEIGHT);

	if per_pixel == 0 {
		panic!("Logs had to be more than {} bytes, found {} bytes", WIDTH * HEIGHT, LOGS.len());
	}

	println!("{} bytes found", LOGS.len());

	let image = cover(WIDTH, HEIGHT, 200).render_multithread_rayon();

	out::write_image("./image.png", &image[..], WIDTH as u32, HEIGHT as u32, LOGS).unwrap();
}
