MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / start_log_stream

Function start_log_stream

crates/cli/src/subcommands/dev.rs:1248–1269  ·  view source on GitHub ↗
(
    mut config: Config,
    database_identity: String,
    server: Option<&str>,
    prefix: Option<String>,
)

Source from the content-addressed store, hash-verified

1246}
1247
1248async 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
1271async fn stream_logs(
1272 host_url: &str,

Callers 1

execFunction · 0.85

Calls 6

get_auth_headerFunction · 0.85
stream_logsFunction · 0.85
get_host_urlMethod · 0.80
OkFunction · 0.50
mapMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…