Added unicode icons in messages
Added unicode icons in messages
This commit is contained in:
29
src/main.rs
29
src/main.rs
@@ -165,7 +165,7 @@ fn main() {
|
||||
};
|
||||
|
||||
if !Path::new(cfg_file).exists() {
|
||||
println!("Error! Can't find configuration file.");
|
||||
println!("\u{26a0} Error! Can't find configuration file.");
|
||||
println!("Exiting...");
|
||||
|
||||
std::process::exit(exitcode::CONFIG);
|
||||
@@ -248,12 +248,12 @@ fn main() {
|
||||
};
|
||||
|
||||
if start_notification && notification_command.to_string() != "" {
|
||||
debug_log(format!("Service started"));
|
||||
debug_log("\u{2139} Service started".to_string());
|
||||
|
||||
let shell_cmd = notification_command.to_string()
|
||||
.replace("<email>", ¬ification_email.to_string())
|
||||
.replace("<subject>", &format!("\"Watchdog service started\""))
|
||||
.replace("<message>", &format!("\"Watchdog service started\""));
|
||||
.replace("<subject>", "\"\u{2139} Watchdog service started\"")
|
||||
.replace("<message>", "\"\u{2139} Watchdog service started\"");
|
||||
|
||||
debug_log(format!("execute {}", shell_cmd));
|
||||
|
||||
@@ -268,14 +268,14 @@ fn main() {
|
||||
if check(tasks[i].uri.clone()).await {
|
||||
if tasks[i].last_state != true || just_started {
|
||||
if tasks[i].command.to_string() == "".to_string() {
|
||||
println!("{} state changed to true", tasks[i].uri);
|
||||
println!("\u{2705} {} state changed to true", tasks[i].uri);
|
||||
} else {
|
||||
debug_log(format!("{} state changed to true", tasks[i].uri));
|
||||
debug_log(format!("\u{2705} {} state changed to true", tasks[i].uri));
|
||||
|
||||
let shell_cmd = tasks[i].command.to_string()
|
||||
.replace("<email>", &tasks[i].email)
|
||||
.replace("<subject>", &format!("\"Service {} ({}) is online\"", tasks[i].service, tasks[i].uri))
|
||||
.replace("<message>", &format!("\"Service {} ({}) is now online\"", tasks[i].service, tasks[i].uri));
|
||||
.replace("<subject>", &format!("\"\u{2705} Service {} ({}) is online\"", tasks[i].service, tasks[i].uri))
|
||||
.replace("<message>", &format!("\"\u{2705} Service {} ({}) is now online\"", tasks[i].service, tasks[i].uri));
|
||||
|
||||
debug_log(format!("execute {}", shell_cmd));
|
||||
|
||||
@@ -283,27 +283,28 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
debug_log(format!("{} check is ok", tasks[i].uri));
|
||||
debug_log(format!("\u{2705} {} check is ok", tasks[i].uri));
|
||||
|
||||
tasks[i].last_state = true;
|
||||
} else {
|
||||
if tasks[i].last_state != false || just_started {
|
||||
if tasks[i].command.to_string() == "".to_string() {
|
||||
println!("{} state changed to false", tasks[i].uri);
|
||||
println!("\u{274c} {} state changed to false", tasks[i].uri);
|
||||
} else {
|
||||
debug_log(format!("{} state changed to false", tasks[i].uri));
|
||||
debug_log(format!("\u{274c} {} state changed to false", tasks[i].uri));
|
||||
|
||||
let shell_cmd = tasks[i].command.to_string()
|
||||
.replace("<email>", &tasks[i].email)
|
||||
.replace("<subject>", &format!("\"Service {} ({}) is offline\"", tasks[i].service, tasks[i].uri))
|
||||
.replace("<message>", &format!("\"Service {} ({}) is now offline\"", tasks[i].service, tasks[i].uri));
|
||||
.replace("<subject>", &format!("\"\u{274c} Service {} ({}) is offline\"", tasks[i].service, tasks[i].uri))
|
||||
.replace("<message>", &format!("\"\u{274c} Service {} ({}) is now offline\"", tasks[i].service, tasks[i].uri))
|
||||
.replace("<icon>", "WARNING");
|
||||
|
||||
debug_log(format!("execute {}", shell_cmd));
|
||||
execute(shell_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
debug_log(format!("{} check failed", tasks[i].uri));
|
||||
debug_log(format!("\u{274c} {} check failed", tasks[i].uri));
|
||||
|
||||
tasks[i].last_state = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user