chore: add DEBUG, logs to monitor

This commit is contained in:
Jesús Pérez Lorenzo 2021-09-14 23:29:00 +01:00
parent 66ccd59f07
commit 07105a7d17

View File

@ -182,7 +182,7 @@ pub async fn run_cache_clouds() -> Result<()> {
arg_env_path=args[idx+1].to_owned();
}
});
println!("Cache service on Clouds: run {} __________ {} / {} ",chrono::Utc::now().timestamp(),&arg_cfg_path,&arg_env_path);
println!("Cache service on Clouds: run {} __________ {} {} ",chrono::Utc::now().timestamp(),&arg_cfg_path,&arg_env_path);
let mut cloud = Cloud::default();
load_cloud_env(&mut cloud).await;
let mut app_env = AppEnv::default();
@ -218,7 +218,7 @@ pub async fn run_check_clouds() -> Result<()> {
arg_env_path=args[idx+1].to_owned();
}
});
println!("Check Cloud services: run {} __________ {} / {} ",chrono::Utc::now().timestamp(),&arg_cfg_path,&arg_env_path);
println!("Check Cloud services: run {} __________ {} {} ",chrono::Utc::now().timestamp(),&arg_cfg_path,&arg_env_path);
let mut cloud = Cloud::default();
load_cloud_env(&mut cloud).await;
let mut app_env = AppEnv::default();
@ -253,7 +253,7 @@ pub async fn run_clouds_monitor() -> Result<()> {
arg_env_path=args[idx+1].to_owned();
}
});
println!("Monitor Cloud: run {} __________ {} / {} ",chrono::Utc::now().timestamp(),&arg_cfg_path,&arg_env_path);
println!("Monitor Cloud: run {} __________ {} {} ",chrono::Utc::now().timestamp(),&arg_cfg_path,&arg_env_path);
let mut cloud = Cloud::default();
load_cloud_env(&mut cloud).await;
let mut app_env = AppEnv::default();
@ -332,20 +332,27 @@ pub async fn main() -> BxDynResult<()> { //std::io::Result<()> {
eprintln!("Task {} no schedule defined",&it.name);
continue;
}
let debug=envmnt::get_isize("DEBUG",0);
let res = match it.name.as_str() {
"monitor" =>
sched.add(Job::new(&it.schedule.to_owned(), move |uuid, _l| {
println!("Schedule {} {}: {}",&it.name,&it.schedule,uuid);
if debug > 0 {
println!("Schedule {} {}: {}",&it.name,&it.schedule,uuid);
}
tokio::spawn(async {run_clouds_monitor().await});
})?),
"check" =>
sched.add(Job::new(&it.schedule.to_owned(), move |uuid, _l| {
println!("Schedule {} {}: {}",&it.name,&it.schedule,uuid);
if debug > 0 {
println!("Schedule {} {}: {}",&it.name,&it.schedule,uuid);
}
tokio::spawn(async {run_check_clouds().await});
})?),
"cache" =>
sched.add(Job::new(&it.schedule.to_owned(), move |uuid, _l| {
println!("Schedule {} {}: {}",&it.name,&it.schedule,uuid);
if debug > 0 {
println!("Schedule {} {}: {}",&it.name,&it.schedule,uuid);
}
tokio::spawn(async {run_cache_clouds().await});
})?),
_ => {