Skip to content

Commit c5c947e

Browse files
committed
feat(repl): Print errors and debug logs to stderr
Follow-up to 545007a.
1 parent 6d8dff5 commit c5c947e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

deltachat-repl/src/cmdline.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async fn poke_eml_file(context: &Context, filename: &Path) -> Result<()> {
8787
let data = read_file(context, filename).await?;
8888

8989
if let Err(err) = receive_imf(context, &data, false).await {
90-
println!("receive_imf errored: {err:?}");
90+
eprintln!("receive_imf errored: {err:?}");
9191
}
9292
Ok(())
9393
}
@@ -621,7 +621,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
621621
println!("Location streaming enabled.");
622622
}
623623
println!("{cnt} chats");
624-
println!("{time_needed:?} to create this list");
624+
eprintln!("{time_needed:?} to create this list");
625625
}
626626
"start-realtime" => {
627627
if arg1.is_empty() {
@@ -731,7 +731,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
731731
chat::marknoticed_chat(&context, sel_chat.get_id()).await?;
732732
let time_noticed_needed = time_noticed_start.elapsed().unwrap_or_default();
733733

734-
println!(
734+
eprintln!(
735735
"{time_needed:?} to create this list, {time_noticed_needed:?} to mark all messages as noticed."
736736
);
737737
}
@@ -985,7 +985,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
985985
},
986986
query,
987987
);
988-
println!("{time_needed:?} to create this list");
988+
eprintln!("{time_needed:?} to create this list");
989989
}
990990
"draft" => {
991991
ensure!(sel_chat.is_some(), "No chat selected.");
@@ -1224,7 +1224,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
12241224
ensure!(!arg1.is_empty(), "Argument <qr-content> missing.");
12251225
match set_config_from_qr(&context, arg1).await {
12261226
Ok(()) => println!("Config set from QR code, you can now call 'configure'"),
1227-
Err(err) => println!("Cannot set config from QR code: {err:?}"),
1227+
Err(err) => eprintln!("Cannot set config from QR code: {err:?}"),
12281228
}
12291229
}
12301230
"createqrsvg" => {

deltachat-repl/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl Validator for DcHelper {}
311311

312312
async fn start(args: Vec<String>) -> Result<(), Error> {
313313
if args.len() < 2 {
314-
println!("Error: Bad arguments, expected [db-name].");
314+
eprintln!("Error: Bad arguments, expected [db-name].");
315315
bail!("No db-name specified");
316316
}
317317
let context = ContextBuilder::new(args[1].clone().into())
@@ -366,7 +366,7 @@ async fn start(args: Vec<String>) -> Result<(), Error> {
366366
false
367367
}
368368
Err(err) => {
369-
println!("Error: {err:#}");
369+
eprintln!("Error: {err:#}");
370370
true
371371
}
372372
}
@@ -381,7 +381,7 @@ async fn start(args: Vec<String>) -> Result<(), Error> {
381381
break;
382382
}
383383
Err(err) => {
384-
println!("Error: {err:#}");
384+
eprintln!("Error: {err:#}");
385385
break;
386386
}
387387
}

0 commit comments

Comments
 (0)