Проектная работа - WIP

This commit is contained in:
8 changed files with 171 additions and 139 deletions
+4 -40
View File
@@ -1,46 +1,10 @@
/// Инициализация логирования
pub fn define_log_layer() -> Option<bevy::log::BoxedFmtLayer> {
use std::fs::File;
use tracing::Level;
use tracing_subscriber::{Layer, filter::Targets, fmt::layer};
let targets = Targets::new().with_default(Level::TRACE);
let stdout = layer()
.compact()
.with_thread_names(true)
.with_file(false)
.with_line_number(false)
.with_filter(targets.clone())
.boxed();
let file = match File::options()
.write(true)
.create(true)
.append(true)
.open("snake-game.log")
{
Ok(file) => file,
Err(e) => {
eprintln!("No access to log file: {:?}", e);
return Some(stdout);
}
};
let log_file = layer()
.compact()
.with_ansi(false)
.with_thread_names(true)
.with_file(false)
.with_line_number(false)
.with_writer(file)
.with_filter(targets.clone())
.boxed();
Some(Box::new(vec![stdout, log_file]))
}
pub mod debug;
mod domain;
mod gameplay;
mod observers;
mod startup;
mod tools;
pub use gameplay::{head_rotation, moving};
pub use startup::{print_all_entities, setup_frame_rate, startup};
pub use startup::{setup_frame_rate, startup};
pub use tools::define_log_layer;