|
1 | 1 | use super::*; |
2 | 2 | use crate::auth::AccessTokenProvider; |
3 | | -use crate::error::sanitize_for_terminal; |
4 | 3 | use crate::helpers::PUBSUB_API_BASE; |
| 4 | +use crate::output::colorize; |
| 5 | +use crate::output::sanitize_for_terminal; |
5 | 6 |
|
6 | 7 | const GMAIL_API_BASE: &str = "https://gmail.googleapis.com/gmail/v1"; |
7 | 8 |
|
@@ -100,7 +101,7 @@ pub(super) async fn handle_watch( |
100 | 101 | " --member=serviceAccount:[email protected] \\" |
101 | 102 | ); |
102 | 103 | eprintln!(" --role=roles/pubsub.publisher"); |
103 | | - eprintln!("Error: {body}"); |
| 104 | + eprintln!("Error: {}", sanitize_for_terminal(&body)); |
104 | 105 | } |
105 | 106 |
|
106 | 107 | t |
@@ -454,7 +455,11 @@ async fn fetch_and_output_messages( |
454 | 455 | } |
455 | 456 | } |
456 | 457 | Err(e) => { |
457 | | - eprintln!("\x1b[33m[WARNING]\x1b[0m Model Armor sanitization failed for message {msg_id}: {}", sanitize_for_terminal(&e.to_string())); |
| 458 | + eprintln!( |
| 459 | + "{} Model Armor sanitization failed for message {msg_id}: {}", |
| 460 | + colorize("warning:", "33"), |
| 461 | + sanitize_for_terminal(&e.to_string()) |
| 462 | + ); |
458 | 463 | } |
459 | 464 | } |
460 | 465 | } |
@@ -498,12 +503,16 @@ fn apply_sanitization_result( |
498 | 503 | match sanitize_config.mode { |
499 | 504 | crate::helpers::modelarmor::SanitizeMode::Block => { |
500 | 505 | eprintln!( |
501 | | - "\x1b[31m[BLOCKED]\x1b[0m Message {msg_id} blocked by Model Armor (match found)" |
| 506 | + "{} Message {msg_id} blocked by Model Armor (match found)", |
| 507 | + colorize("blocked:", "31") |
502 | 508 | ); |
503 | 509 | return None; |
504 | 510 | } |
505 | 511 | crate::helpers::modelarmor::SanitizeMode::Warn => { |
506 | | - eprintln!("\x1b[33m[WARNING]\x1b[0m Model Armor match found in message {msg_id}"); |
| 512 | + eprintln!( |
| 513 | + "{} Model Armor match found in message {msg_id}", |
| 514 | + colorize("warning:", "33") |
| 515 | + ); |
507 | 516 | full_msg["_sanitization"] = serde_json::json!({ |
508 | 517 | "filterMatchState": result.filter_match_state, |
509 | 518 | "filterResults": result.filter_results, |
|
0 commit comments