Skip to content

Commit

Permalink
Merge pull request rustdesk#6459 from 21pages/format_log
Browse files Browse the repository at this point in the history
format log
  • Loading branch information
rustdesk authored Nov 18, 2023
2 parents 0b5f48b + f9ee018 commit efc84e5
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions libs/hbb_common/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ impl TransferJob {
msg.set_file_response(resp);
stream.send(&msg).await?;
log::info!(
"id: {}, file_num:{}, digest message is sent. waiting for confirm. msg: {:?}",
"id: {}, file_num: {}, digest message is sent. waiting for confirm. msg: {:?}",
self.id,
self.file_num,
msg
Expand Down Expand Up @@ -723,7 +723,7 @@ pub fn new_receive(

#[inline]
pub fn new_send(id: i32, path: String, file_num: i32, include_hidden: bool) -> Message {
log::info!("new send: {},id : {}", path, id);
log::info!("new send: {}, id: {}", path, id);
let mut action = FileAction::new();
action.set_send(FileTransferSendRequest {
id,
Expand Down
6 changes: 3 additions & 3 deletions libs/scrap/src/common/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub enum EncodingUpdate {

impl Encoder {
pub fn new(config: EncoderCfg, i444: bool) -> ResultType<Encoder> {
log::info!("new encoder:{config:?}, i444:{i444}");
log::info!("new encoder: {config:?}, i444: {i444}");
match config {
EncoderCfg::VPX(_) => Ok(Encoder {
codec: Box::new(VpxEncoder::new(config, i444)?),
Expand Down Expand Up @@ -215,7 +215,7 @@ impl Encoder {
}

log::info!(
"connection count:{}, used preference:{:?}, encoder:{:?}",
"connection count: {}, used preference: {:?}, encoder: {:?}",
decodings.len(),
preference,
*name
Expand Down Expand Up @@ -600,7 +600,7 @@ pub fn codec_thread_num() -> usize {
None => true,
};
if log {
log::info!("cpu num:{max}, {info}, codec thread:{res}");
log::info!("cpu num: {max}, {info}, codec thread: {res}");
*THREAD_LOG_TIME.lock().unwrap() = Some(Instant::now());
}
res
Expand Down
4 changes: 2 additions & 2 deletions libs/scrap/src/common/mediacodec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ fn create_media_codec(name: &str, direction: MediaCodecDirection) -> Option<Medi
media_format.set_i32("height", 0);
media_format.set_i32("color-format", 19); // COLOR_FormatYUV420Planar
if let Err(e) = codec.configure(&media_format, None, direction) {
log::error!("Failed to init decoder:{:?}", e);
log::error!("Failed to init decoder: {:?}", e);
return None;
};
log::error!("decoder init success");
if let Err(e) = codec.start() {
log::error!("Failed to start decoder:{:?}", e);
log::error!("Failed to start decoder: {:?}", e);
return None;
};
log::debug!("Init decoder successed!: {:?}", name);
Expand Down
2 changes: 1 addition & 1 deletion libs/scrap/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ pub trait GoogleImage {
);
}
// (Chroma::I444, ImageFormat::Raw), new version libyuv have I444ToRAW
_ => log::error!("unsupported pixfmt:{:?}", self.chroma()),
_ => log::error!("unsupported pixfmt: {:?}", self.chroma()),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/scrap/src/common/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl RecorderContext {
".mp4"
};
self.filename = PathBuf::from(&dir).join(file).to_string_lossy().to_string();
log::info!("video will save to:{}", self.filename);
log::info!("video will save to {}", self.filename);
Ok(())
}
}
Expand Down Expand Up @@ -225,7 +225,7 @@ impl Recorder {
let old_pts = self.pts;
self.pts = Some(pts);
if old_pts.clone().unwrap_or_default() > pts {
log::info!("pts {:?}->{}, change record filename", old_pts, pts);
log::info!("pts {:?} -> {}, change record filename", old_pts, pts);
self.change(self.ctx.clone())?;
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,7 @@ where
}
}
MediaData::RecordScreen(start, display, w, h, id) => {
log::info!("record screen command: start:{start}, display:{display}");
log::info!("record screen command: start: {start}, display: {display}");
if handler_controller_map.len() == 1 {
// Compatible with the sciter version(single ui session).
// For the sciter version, there're no multi-ui-sessions for one connection.
Expand Down
2 changes: 1 addition & 1 deletion src/core_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub fn core_main() -> Option<Vec<String>> {
{
use crate::portable_service::client;
if let Err(e) = client::start_portable_service(client::StartPara::Direct) {
log::error!("Failed to start portable service:{:?}", e);
log::error!("Failed to start portable service: {:?}", e);
}
}
#[cfg(windows)]
Expand Down
2 changes: 1 addition & 1 deletion src/flutter_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,7 @@ pub fn main_test_wallpaper(_second: u64) {
std::thread::sleep(std::time::Duration::from_secs(_second));
}
Err(e) => {
log::info!("create wallpaper remover failed:{:?}", e);
log::info!("create wallpaper remover failed: {:?}", e);
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/hbbs_http/record_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ pub fn run(rx: Receiver<RecordState>) {
}
},
Err(e) => {
log::trace!("upload thread stop:{}", e);
log::trace!("upload thread stop: {}", e);
break;
}
} {
uploader.running = false;
log::error!("upload stop:{}", e);
log::error!("upload stop: {}", e);
}
});
}
Expand Down Expand Up @@ -184,7 +184,7 @@ impl RecordUploader {
],
buf,
)?;
log::info!("upload success, file:{}", self.filename);
log::info!("upload success, file: {}", self.filename);
Ok(())
}
Err(e) => bail!(e.to_string()),
Expand Down
2 changes: 1 addition & 1 deletion src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ pub fn start_grab_loop() {
if let Err(err) = rdev::start_grab_listen(move |event: Event| match event.event_type {
EventType::KeyPress(key) | EventType::KeyRelease(key) => {
if let Key::Unknown(keycode) = key {
log::error!("rdev get unknown key, keycode is : {:?}", keycode);
log::error!("rdev get unknown key, keycode is {:?}", keycode);
} else {
client::process_event(&get_keyboard_mode(), &event, None);
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ impl WallPaperRemover {
wallpaper::set_from_path("").map_err(|e| anyhow!(e.to_string()))?;
wallpaper::set_dark_from_path("").ok();
log::info!(
"created wallpaper remover, old_path:{:?}, old_path_dark:{:?}, elapsed:{:?}",
"created wallpaper remover, old_path: {:?}, old_path_dark: {:?}, elapsed: {:?}",
old_path,
old_path_dark,
start.elapsed(),
Expand Down
14 changes: 7 additions & 7 deletions src/platform/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ pub fn run_as_system(arg: &str) -> ResultType<()> {
pub fn elevate_or_run_as_system(is_setup: bool, is_elevate: bool, is_run_as_system: bool) {
// avoid possible run recursively due to failed run.
log::info!(
"elevate:{}->{:?}, run_as_system:{}->{}",
"elevate: {} -> {:?}, run_as_system: {} -> {}",
is_elevate,
is_elevated(None),
is_run_as_system,
Expand Down Expand Up @@ -1534,7 +1534,7 @@ pub fn elevate_or_run_as_system(is_setup: bool, is_elevate: bool, is_run_as_syst
std::process::exit(0);
} else {
unsafe {
log::error!("Failed to run as system, errno={}", GetLastError());
log::error!("Failed to run as system, errno = {}", GetLastError());
}
}
}
Expand All @@ -1544,14 +1544,14 @@ pub fn elevate_or_run_as_system(is_setup: bool, is_elevate: bool, is_run_as_syst
std::process::exit(0);
} else {
unsafe {
log::error!("Failed to elevate, errno={}", GetLastError());
log::error!("Failed to elevate, errno = {}", GetLastError());
}
}
}
}
}
Err(_) => unsafe {
log::error!("Failed to get elevation status, errno={}", GetLastError());
log::error!("Failed to get elevation status, errno = {}", GetLastError());
},
}
}
Expand Down Expand Up @@ -2409,13 +2409,13 @@ impl WallPaperRemover {
let old_path = match Self::get_recent_wallpaper() {
Ok(old_path) => old_path,
Err(e) => {
log::info!("Failed to get recent wallpaper:{:?}, use fallback", e);
log::info!("Failed to get recent wallpaper: {:?}, use fallback", e);
wallpaper::get().map_err(|e| anyhow!(e.to_string()))?
}
};
Self::set_wallpaper(None)?;
log::info!(
"created wallpaper remover, old_path:{:?}, elapsed:{:?}",
"created wallpaper remover, old_path: {:?}, elapsed: {:?}",
old_path,
start.elapsed(),
);
Expand All @@ -2433,7 +2433,7 @@ impl WallPaperRemover {
let (hkcu, sid) = if is_root() {
let username = get_active_username();
let sid = get_sid_of_user(&username)?;
log::info!("username:{username}, sid:{sid}");
log::info!("username: {username}, sid: {sid}");
(RegKey::predef(HKEY_USERS), format!("{}\\", sid))
} else {
(RegKey::predef(HKEY_CURRENT_USER), "".to_string())
Expand Down
8 changes: 4 additions & 4 deletions src/server/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ impl Connection {
#[cfg(windows)]
ipc::Data::DataPortableService(ipc::DataPortableService::RequestStart) => {
if let Err(e) = portable_client::start_portable_service(portable_client::StartPara::Direct) {
log::error!("Failed to start portable service from cm:{:?}", e);
log::error!("Failed to start portable service from cm: {:?}", e);
}
}
ipc::Data::SwitchSidesBack => {
Expand Down Expand Up @@ -1267,7 +1267,7 @@ impl Connection {
});
}
Err(e) => {
log::info!("create wallpaper remover failed:{:?}", e);
log::info!("create wallpaper remover failed: {:?}", e);
}
}
}
Expand Down Expand Up @@ -2143,7 +2143,7 @@ impl Connection {
if self.restart {
match system_shutdown::reboot() {
Ok(_) => log::info!("Restart by the peer"),
Err(e) => log::error!("Failed to restart:{}", e),
Err(e) => log::error!("Failed to restart: {}", e),
}
}
}
Expand Down Expand Up @@ -2410,7 +2410,7 @@ impl Connection {
crate::platform::change_resolution(&name, r.width as _, r.height as _)
{
log::error!(
"Failed to change resolution '{}' to ({},{}):{:?}",
"Failed to change resolution '{}' to ({},{}): {:?}",
&name,
r.width,
r.height,
Expand Down
12 changes: 6 additions & 6 deletions src/server/portable_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl SharedMemory {
bail!("Unable to create shmem flink {} : {}", flink, e);
}
};
log::info!("Create shared memory, size:{}, flink:{}", size, flink);
log::info!("Create shared memory, size: {}, flink: {}", size, flink);
set_path_permission(&PathBuf::from(flink), "F").ok();
Ok(SharedMemory { inner: shmem })
}
Expand All @@ -102,7 +102,7 @@ impl SharedMemory {
bail!("Unable to open existing shmem flink {} : {}", flink, e);
}
};
log::info!("open existing shared memory, flink:{:?}", flink);
log::info!("open existing shared memory, flink: {:?}", flink);
Ok(SharedMemory { inner: shmem })
}

Expand Down Expand Up @@ -351,15 +351,15 @@ pub mod server {
}
}
Err(e) => {
log::error!("Failed to create gdi capturer:{:?}", e);
log::error!("Failed to create gdi capturer: {:?}", e);
std::thread::sleep(std::time::Duration::from_secs(1));
continue;
}
}
} else {
if recreate || current_display != last_current_display {
log::info!(
"create capturer, display:{}->{}",
"create capturer, display: {} -> {}",
last_current_display,
current_display,
);
Expand Down Expand Up @@ -399,7 +399,7 @@ pub mod server {
Some(Err(e)) => {
if e.kind() != std::io::ErrorKind::WouldBlock {
// DXGI_ERROR_INVALID_CALL after each success on Microsoft GPU driver
// log::error!("capture frame failed:{:?}", e);
// log::error!("capture frame failed: {:?}", e);
if crate::platform::windows::desktop_changed() {
crate::platform::try_change_desktop();
c = None;
Expand Down Expand Up @@ -500,7 +500,7 @@ pub mod server {
}
}
Err(e) => {
log::error!("Failed to connect portable service ipc:{:?}", e);
log::error!("Failed to connect portable service ipc: {:?}", e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/video_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ fn run(vs: VideoService) -> ResultType<()> {
let mut spf;
let mut quality = video_qos.quality();
let abr = VideoQoS::abr_enabled();
log::info!("init quality={:?}, abr enabled:{}", quality, abr);
log::info!("initial quality: {quality:?}, abr enabled: {abr}");
let codec_name = Encoder::negotiated_codec();
let recorder = get_recorder(c.width, c.height, &codec_name);
let last_recording = recorder.lock().unwrap().is_some() || video_qos.record();
Expand Down

0 comments on commit efc84e5

Please sign in to comment.