mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-15 15:16:37 +00:00
Init UIThreadLogger
in UIThread::new
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
584b61144e
commit
72cf83bcbc
1 changed files with 4 additions and 1 deletions
|
@ -1,10 +1,12 @@
|
|||
use std::io::{self, BufRead, Write};
|
||||
|
||||
use bytes::Bytes;
|
||||
use log::LevelFilter;
|
||||
use std::sync::mpsc as mpsc_sync;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::task::spawn_blocking;
|
||||
|
||||
use super::ui_thread_logger::UIThreadLogger;
|
||||
use crate::BinstallError;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -97,8 +99,9 @@ pub struct UIThread(Option<UIThreadInner>);
|
|||
|
||||
impl UIThread {
|
||||
/// * `enable` - `true` to enable confirmation, `false` to disable it.
|
||||
pub fn new(enable: bool) -> Self {
|
||||
pub fn new(enable: bool, level: LevelFilter, filter_ignore: &'static [&'static str]) -> Self {
|
||||
let ui_thread = UIThreadInner::new();
|
||||
UIThreadLogger::init(ui_thread.request_tx.clone(), level, filter_ignore);
|
||||
Self(enable.then(|| ui_thread))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue