1
0
Fork 0
forked from wry/wry

portal: stream logs when starting from cli

This commit is contained in:
Julian Orth 2024-04-18 15:17:04 +02:00
parent 17a0dfed5e
commit 02e8d9eb80
2 changed files with 32 additions and 11 deletions

View file

@ -76,12 +76,13 @@ impl Logger {
self.path.lock().clone()
}
pub fn redirect(&self, ty: &str) {
pub fn redirect(&self, ty: &str) -> Ustring {
let (file, fd) = open_log_file(ty);
log::info!("Redirecting logs to {}", file.display());
*self.path.lock() = Arc::new(file.as_bytes().into());
self.file_fd.store(fd.raw(), Relaxed);
*self._file.lock() = fd;
file
}
pub fn write_raw(&self, buf: &[u8]) {