Skip to content

Commit

Permalink
service: Remove stdout/stderr redirect
Browse files Browse the repository at this point in the history
If still needed, it should be handled by the frontend (perhaps using a separate native library)
  • Loading branch information
madadam committed Jan 21, 2025
1 parent 96f50ff commit bbf8674
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 147 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ hmac = { workspace = true }
hyper = { version = "1.4.1", features = ["server", "http1"] }
indexmap = { workspace = true }
interprocess = { version = "2.2.2", features = ["tokio"] }
libc = "0.2.147"

This comment has been minimized.

Copy link
@za-creature

za-creature Jan 21, 2025

Collaborator

🍾

maxminddb = "0.24.0"
metrics = { workspace = true }
metrics-exporter-prometheus = { workspace = true }
num_enum = { workspace = true }
ouisync = { path = "../lib" }
ouisync-tracing-fmt = { path = "../tracing_fmt" }
ouisync-vfs = { path = "../vfs" }
os_pipe = { version = "1.1.4", features = ["io_safety"] }
pem = { workspace = true }
rand = { workspace = true }
rmp-serde = { workspace = true }
Expand Down
5 changes: 1 addition & 4 deletions service/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,7 @@ unsafe fn try_init_log(
(builder, None)
};

let logger = builder
.redirect()
.build()
.map_err(Error::InitializeLogger)?;
let logger = builder.build().map_err(Error::InitializeLogger)?;

LOGGER
.set(LoggerWrapper {
Expand Down
21 changes: 2 additions & 19 deletions service/src/logger/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod callback;
mod color;
mod format;
mod redirect;
mod stdout;

pub use callback::{BufferPool, Callback};
Expand Down Expand Up @@ -34,7 +33,6 @@ pub struct Builder<'a> {
callback: Option<(Box<Callback>, BufferPool)>,
format: LogFormat,
color: LogColor,
redirect: bool,
}

impl<'a> Builder<'a> {
Expand Down Expand Up @@ -72,14 +70,6 @@ impl<'a> Builder<'a> {
Self { color, ..self }
}

/// Redirect stdout and stderr to the log
pub fn redirect(self) -> Self {
Self {
redirect: true,
..self
}
}

pub fn build(self) -> io::Result<Logger> {
if let Some(parent) = self.file.and_then(|path| path.parent()) {
fs::create_dir_all(parent)?;
Expand Down Expand Up @@ -119,17 +109,11 @@ impl<'a> Builder<'a> {
default_panic_hook(panic_info);
}));

let redirect = self.redirect.then(redirect::Redirect::new).transpose()?;

Ok(Logger {
_redirect: redirect,
})
Ok(Logger)
}
}

pub struct Logger {
_redirect: Option<redirect::Redirect>,
}
pub struct Logger;

impl Logger {
pub fn builder<'a>() -> Builder<'a> {
Expand All @@ -139,7 +123,6 @@ impl Logger {
callback: None,
format: LogFormat::Human,
color: LogColor::Auto,
redirect: false,
}
}

Expand Down
120 changes: 0 additions & 120 deletions service/src/logger/redirect.rs

This file was deleted.

0 comments on commit bbf8674

Please sign in to comment.