tweak logging
This commit is contained in:
parent
7cfb07241c
commit
111bf2b490
3 changed files with 13 additions and 7 deletions
|
|
@ -410,7 +410,7 @@ impl Daemon {
|
|||
};
|
||||
debug!("got cmd: {cmd:?}");
|
||||
let _ = rustix::io::write(fd, b"");
|
||||
info!("dispatching command");
|
||||
info!("dispatching command {cmd:?}");
|
||||
self.dispatch_cmd(cmd).unwrap_or_else(|e| todo!("{e}"));
|
||||
}
|
||||
|
||||
|
|
@ -461,6 +461,14 @@ impl Daemon {
|
|||
.arg("--impure")
|
||||
.arg("-E")
|
||||
.arg(expr)
|
||||
.tap(|cmd| {
|
||||
if !tracing::enabled!(Level::INFO) {
|
||||
return;
|
||||
}
|
||||
let args: Vec<Cow<'_, str>> = cmd.get_args().map(OsStr::to_string_lossy).collect();
|
||||
let separated = args.join(" ");
|
||||
info!("Spawning subprocess: [{separated}]");
|
||||
})
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
|
|
@ -638,7 +646,7 @@ impl Daemon {
|
|||
let either_available = event.is_readable() || event.is_writable();
|
||||
if !either_available {
|
||||
info!(
|
||||
"File descriptor {} r:{}, w:{}",
|
||||
"Got EVENT for file descriptor '{}': r={}, w={}",
|
||||
info.display(),
|
||||
event.is_readable(),
|
||||
event.is_writable(),
|
||||
|
|
@ -663,7 +671,7 @@ impl Daemon {
|
|||
todo!("waitid() returned None? for pid {pid}");
|
||||
});
|
||||
|
||||
debug!("waitid() for pid {pid} returned status: {status:?}");
|
||||
trace!("waitid() for pid {pid} returned status: {status:?}");
|
||||
let is_dead = status.exited() || status.killed() || status.dumped();
|
||||
if !is_dead {
|
||||
todo!("Handle process {pid} events that aren't death: {status:?}");
|
||||
|
|
@ -690,14 +698,12 @@ impl Daemon {
|
|||
}
|
||||
},
|
||||
FdKind::ChildStdout(_pid) => {
|
||||
warn!("got stdout");
|
||||
// SAFETY: oh boy.
|
||||
let stdout = unsafe { BorrowedFd::borrow_raw(fd) };
|
||||
self.proxy_stdio(&stdout)
|
||||
.unwrap_or_else(|e| error!("failed to proxy child stdout: {e}"));
|
||||
},
|
||||
FdKind::ChildStderr(_pid) => {
|
||||
warn!("got stderr");
|
||||
// SAFETY: oh boy.
|
||||
let stderr = unsafe { BorrowedFd::borrow_raw(fd) };
|
||||
self.proxy_stdio(&stderr)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ fn main_wrapped() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
|
|||
// Default RUST_LOG to warn if it's not specified.
|
||||
if env::var_os("RUST_LOG").is_none() {
|
||||
unsafe {
|
||||
env::set_var("RUST_LOG", "warn");
|
||||
env::set_var("RUST_LOG", "info");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ in
|
|||
path = [ config.nix.package ];
|
||||
serviceConfig = {
|
||||
Environment = [
|
||||
"RUST_LOG=info,dynix=trace"
|
||||
"RUST_LOG=info,dynix=debug"
|
||||
];
|
||||
ExecSearchPath = [ "/run/current-system/sw/bin" ];
|
||||
SuccessExitStatus = [ "0" "2" ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue