This commit is contained in:
Maxime Van Hees
2025-08-06 14:34:56 +02:00
parent 9f9149a950
commit 9c4fa1a78b
18 changed files with 2641 additions and 33 deletions

View File

@@ -4,17 +4,11 @@ use std::time::Duration;
use hero_supervisor::{SupervisorBuilder, SupervisorError};
use hero_websocket_server::ServerBuilder;
use tokio::signal;
use log::{info, error};
use env_logger::Builder;
use tracing::{info, error};
/// The main entry point of the Hero Supervisor.
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize logging
env_logger::Builder::from_default_env()
.filter_level(log::LevelFilter::Info)
.init();
info!("Hero Supervisor starting up...");
// Get config path from command line arguments or use default
@@ -41,6 +35,17 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let actor_configs = supervisor.get_actor_configs()?;
info!("Loaded {} actor configurations from TOML", actor_configs.len());
// Initialize the system logger with all components
let mut system_components = vec!["supervisor".to_string()];
for config in &actor_configs {
system_components.push(config.name.clone()); // e.g., "osis_actor_1"
}
// Initialize the logger for all system components
let _logger_guards = hero_logger::init_system_logger("logs", &system_components)?;
info!(target: "supervisor", "System logger initialized with {} components", system_components.len());
// Spawn the background lifecycle manager with 5-minute health check interval
let health_check_interval = Duration::from_secs(5 * 60); // 5 minutes
let mut lifecycle_handle = supervisor.clone().spawn_lifecycle_manager(actor_configs, health_check_interval);