1569572ba0
The game writes logs/latest.log in its home like vanilla's log4j config (client-1.21.2.xml): [HH:mm:ss] [thread/LEVEL]: message, rolled at start and at midnight to logs/<date>-<n>.log.gz, seven a day. Messages go through the log facade and still print their old text on stderr. A main-thread panic or a fatal error writes crash-reports/crash-<date>_<time>-client.txt (error, stack, Horizon and Minecraft versions, OS, CPU, memory, GPU adapter, render settings, resource packs, world, last 50 log lines). Development builds crash on purpose with HORIZON_DEBUG_CRASH. The launcher shows "Horizon crashed" when the game it started ends badly, with Open report, Copy report, Open logs folder and Report on Discord; Settings gets a Logs row. horizon-launcher logs and horizon-ctl logs (--lines N, --crash) print the log's end or the newest report, and both MCP servers have a logs tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.3 KiB
Rust
37 lines
1.3 KiB
Rust
//! Horizon: native Rust client for Minecraft Java Edition 26.3 gameplay.
|
|
#![forbid(unsafe_code)]
|
|
mod game;
|
|
|
|
use horizon_client::{crash, logging};
|
|
|
|
fn main() {
|
|
let args: Vec<String> = std::env::args().skip(1).collect();
|
|
let game_args = args.iter().take_while(|a| *a != "--dedicated");
|
|
let help = game_args.clone().any(|a| a == "--help" || a == "-h");
|
|
// The dedicated server logs in its own folder, as vanilla's does; the game in its home.
|
|
let (home, side, thread) = if args.iter().any(|a| a == "--dedicated") {
|
|
(std::path::PathBuf::from("."), "server", "Server thread")
|
|
} else {
|
|
(logging::game_home(), "client", "Render thread")
|
|
};
|
|
if !help {
|
|
logging::init(&home, thread);
|
|
crash::install(home.clone(), side);
|
|
}
|
|
if let Err(error) = game::run() {
|
|
log::error!("Horizon: {error}");
|
|
if !help {
|
|
crash::report_error(&home, side, &*error);
|
|
}
|
|
// Started from Explorer, the console window closes with the game:
|
|
// keep the message on screen until it is read.
|
|
#[cfg(windows)]
|
|
if std::io::IsTerminal::is_terminal(&std::io::stdin()) {
|
|
eprintln!("Press Enter to close.");
|
|
let _ = std::io::stdin().read_line(&mut String::new());
|
|
}
|
|
std::process::exit(1);
|
|
}
|
|
logging::flush();
|
|
}
|