(
mut config: Config,
database_identity: String,
server: Option<&str>,
prefix: Option<String>,
)
| 1246 | } |
| 1247 | |
| 1248 | async fn start_log_stream( |
| 1249 | mut config: Config, |
| 1250 | database_identity: String, |
| 1251 | server: Option<&str>, |
| 1252 | prefix: Option<String>, |
| 1253 | ) -> Result<JoinHandle<()>, anyhow::Error> { |
| 1254 | let server = server.map(|s| s.to_string()); |
| 1255 | let host_url = config.get_host_url(server.as_deref())?; |
| 1256 | let auth_header = get_auth_header(&mut config, false, server.as_deref(), false).await?; |
| 1257 | |
| 1258 | let handle = tokio::spawn(async move { |
| 1259 | loop { |
| 1260 | if let Err(e) = stream_logs(&host_url, &database_identity, &auth_header, prefix.as_deref()).await { |
| 1261 | eprintln!("\n{} Log streaming error: {}", "Error:".red().bold(), e); |
| 1262 | eprintln!("{}", "Reconnecting in 10 seconds...".yellow()); |
| 1263 | tokio::time::sleep(Duration::from_secs(10)).await; |
| 1264 | } |
| 1265 | } |
| 1266 | }); |
| 1267 | |
| 1268 | Ok(handle) |
| 1269 | } |
| 1270 | |
| 1271 | async fn stream_logs( |
| 1272 | host_url: &str, |
no test coverage detected
searching dependent graphs…