+1
Cargo.lock
+1
Cargo.lock
+1
Cargo.toml
+1
Cargo.toml
+18
-14
src/main.rs
+18
-14
src/main.rs
···
113
113
let json = serde_json::to_value(post)?;
114
114
let data = Data::from_json(&json)?;
115
115
116
-
println!("\nposting...");
116
+
log::info!("\nposting...");
117
117
client
118
118
.send(
119
119
CreateRecord::new()
···
240
240
.await?
241
241
.into_output()?,
242
242
);
243
-
println!("logged in as {} ({})", session.handle, session.did);
243
+
log::debug!("logged in as {} ({})", session.handle, session.did);
244
244
client.set_session(session).await?;
245
245
246
246
let slingshot_client = reqwest::Client::builder()
···
261
261
.connect_cursor(args.jetstream_cursor.map(Cursor::from_raw_u64))
262
262
.await?;
263
263
264
-
println!("receiving jetstream messages...");
264
+
log::info!("receiving jetstream messages...");
265
265
loop {
266
266
let Some(event) = receiver.recv().await else {
267
-
eprintln!("consumer: could not receive event, bailing");
267
+
log::error!("consumer: could not receive event, bailing");
268
268
break;
269
269
};
270
270
···
277
277
if added.key
278
278
== "at://did:plc:wshs7t2adsemcrrd4snkeqli/sh.tangled.label.definition/good-first-issue"
279
279
{
280
-
println!("found a good first issue label!! {:?}", cursor);
280
+
log::info!("found a good first issue label!! {:?}", cursor);
281
281
added_good_first_issue = true;
282
282
break; // inner
283
283
}
284
-
eprintln!("found a label but it wasn't good-first-issue, ignoring...");
284
+
log::debug!("found a label but it wasn't good-first-issue, ignoring...");
285
285
}
286
286
if !added_good_first_issue {
287
287
continue;
···
290
290
let IssueRecord { title, repo } = match get_record(&slingshot_client, &subject).await {
291
291
Ok(m) => m,
292
292
Err(e) => {
293
-
eprintln!("failed to get issue record: {e} for {subject}");
293
+
log::warn!("failed to get issue record: {e} for {subject}");
294
294
continue;
295
295
}
296
296
};
297
297
298
298
let Ok(repo_uri) = AtUri::new(&repo) else {
299
-
eprintln!("failed to parse repo to aturi for {subject}");
299
+
log::warn!("failed to parse repo to aturi for {subject}");
300
300
continue;
301
301
};
302
302
303
303
let RepoRecord { name: repo_name } = match get_record(&slingshot_client, &repo).await {
304
304
Ok(m) => m,
305
305
Err(e) => {
306
-
eprintln!("failed to get repo record: {e} for {subject}");
306
+
log::warn!("failed to get repo record: {e} for {subject}");
307
307
continue;
308
308
}
309
309
};
···
312
312
AtIdentifier::Handle(h) => format!("@{h}"),
313
313
AtIdentifier::Did(did) => match get_handle(&slingshot_client, did.as_str()).await {
314
314
Err(e) => {
315
-
eprintln!("failed to get mini doc from repo identifier: {e} for {subject}");
315
+
log::warn!("failed to get mini doc from repo identifier: {e} for {subject}");
316
316
continue;
317
317
}
318
318
Ok(None) => did.to_string(),
···
326
326
let issues_url = format!("https://tangled.org/{nice_tangled_repo_id}/{repo_name}/issues");
327
327
328
328
if args.dry_run {
329
-
println!("--dry-run, but would have posted:");
330
-
println!("good-first-issue label added for {repo_full_name} ({repo_url}):");
331
-
println!("> {title} ({issues_url})\n");
329
+
log::info!(
330
+
r#"--dry-run, but would have posted:
331
+
332
+
good-first-issue label added for {repo_full_name} ({repo_url}):
333
+
334
+
> {title} ({issues_url})"#
335
+
);
332
336
continue;
333
337
}
334
338
···
342
346
)
343
347
.await
344
348
{
345
-
eprintln!("failed to post for {subject}: {e}");
349
+
log::error!("failed to post for {subject}: {e}");
346
350
};
347
351
348
352
break;