From 5ccff722ef186619d28a00ebf77216d795b00e3e Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 8 Jun 2019 15:37:55 -0700 Subject: [PATCH] more log --- pty/Cargo.toml | 1 + pty/src/cmdbuilder.rs | 4 +++- pty/src/win/winpty/mod.rs | 3 ++- termwiz/Cargo.toml | 1 + termwiz/src/escape/parser/mod.rs | 3 ++- termwiz/src/render/terminfo.rs | 3 ++- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pty/Cargo.toml b/pty/Cargo.toml index 95a8f2661..efee74791 100644 --- a/pty/Cargo.toml +++ b/pty/Cargo.toml @@ -12,6 +12,7 @@ documentation = "https://docs.rs/portable-pty" failure = "0.1" failure_derive = "0.1" filedescriptor = "0.2" +log = "0.4" libc = "0.2" serde_derive = {version="1.0", optional=true} serde = {version="1.0", optional=true} diff --git a/pty/src/cmdbuilder.rs b/pty/src/cmdbuilder.rs index 1a3116dd1..28ed4f6a1 100644 --- a/pty/src/cmdbuilder.rs +++ b/pty/src/cmdbuilder.rs @@ -1,5 +1,7 @@ #[cfg(windows)] use failure::{ensure, Error}; +#[cfg(windows)] +use log::error; use std::ffi::{OsStr, OsString}; #[cfg(windows)] use std::os::windows::ffi::OsStrExt; @@ -47,7 +49,7 @@ impl CommandBuilder { self.envs .push((key.as_ref().to_owned(), val.as_ref().to_owned())); #[cfg(windows)] - eprintln!( + error!( "ignoring env {:?}={:?} for child; FIXME: implement this!", key.as_ref(), val.as_ref() diff --git a/pty/src/win/winpty/mod.rs b/pty/src/win/winpty/mod.rs index fb6090239..906022818 100644 --- a/pty/src/win/winpty/mod.rs +++ b/pty/src/win/winpty/mod.rs @@ -6,6 +6,7 @@ use crate::win::winpty::safe::{ use crate::{Child, MasterPty, PtySize, PtySystem, SlavePty}; use failure::{bail, Error}; use filedescriptor::FileDescriptor; +use log::debug; use std::ffi::OsString; use std::os::windows::ffi::OsStringExt; use std::path::Path; @@ -63,7 +64,7 @@ impl SlavePty for WinPtySlavePty { fn spawn_command(&self, cmd: CommandBuilder) -> Result, Error> { let (exe, cmdline) = cmd.cmdline()?; let cmd_os = OsString::from_wide(&cmdline); - eprintln!( + debug!( "Running: module: {} {:?}", Path::new(&OsString::from_wide(&exe)).display(), cmd_os diff --git a/termwiz/Cargo.toml b/termwiz/Cargo.toml index c687e4965..de558089e 100644 --- a/termwiz/Cargo.toml +++ b/termwiz/Cargo.toml @@ -20,6 +20,7 @@ filedescriptor = "0.2" fnv = "1.0" image = "0.21" libc = "0.2" +log = "0.4" memmem = "0.1" num = "0.2" num-traits = "0.2" diff --git a/termwiz/src/escape/parser/mod.rs b/termwiz/src/escape/parser/mod.rs index 0d3998b0d..0c35c13c7 100644 --- a/termwiz/src/escape/parser/mod.rs +++ b/termwiz/src/escape/parser/mod.rs @@ -1,4 +1,5 @@ use crate::escape::{Action, DeviceControlMode, Esc, OperatingSystemCommand, CSI}; +use log::error; use num; use std::cell::RefCell; use vte; @@ -93,7 +94,7 @@ impl<'a, F: FnMut(Action)> vte::Perform for Performer<'a, F> { fn execute(&mut self, byte: u8) { match num::FromPrimitive::from_u8(byte) { Some(code) => (self.callback)(Action::Control(code)), - None => eprintln!("impossible C0/C1 control code {:?} was dropped", byte), + None => error!("impossible C0/C1 control code {:?} was dropped", byte), } } diff --git a/termwiz/src/render/terminfo.rs b/termwiz/src/render/terminfo.rs index 1b8b44fe0..1dd93980c 100644 --- a/termwiz/src/render/terminfo.rs +++ b/termwiz/src/render/terminfo.rs @@ -9,6 +9,7 @@ use crate::image::TextureCoordinate; use crate::surface::{Change, CursorShape, Position}; use crate::terminal::unix::UnixTty; use failure::Fallible; +use log::error; use std::io::{Read, Write}; use terminfo::{capability as cap, Capability as TermInfoCapability}; @@ -497,7 +498,7 @@ impl TerminfoRenderer { } } Change::CursorPosition { .. } => { - eprintln!( + error!( "unhandled CursorPosition in TerminfoRenderer::render_to: {:?}", change );