logger
This commit is contained in:
19
cmd/main.rs
19
cmd/main.rs
@@ -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);
|
||||
|
Reference in New Issue
Block a user