Skip to content

Commit

Permalink
feat: remove redirect stderr to file (#938)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Jan 9, 2025
1 parent 7e9ccae commit 9ce4632
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion dragonfly-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ indicatif = "0.17.9"
dashmap = "6.1.0"
fs2 = "0.4.3"
hashring = "0.3.6"
libc = "0.2"
fslock = "0.2.1"
leaky-bucket = "1.1.2"
http-body-util = "0.1.2"
Expand Down
21 changes: 0 additions & 21 deletions dragonfly-client/src/tracing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
use opentelemetry::sdk::propagation::TraceContextPropagator;
use rolling_file::*;
use std::fs;
use std::fs::OpenOptions;
use std::os::unix::io::AsRawFd;
use std::path::PathBuf;
use tracing::{info, Level};
use tracing_appender::non_blocking::WorkerGuard;
Expand Down Expand Up @@ -133,24 +131,5 @@ pub fn init_tracing(
log_level
);

// Redirect stderr to file.
if !verbose {
redirect_stderr_to_file(log_dir);
}

guards
}

/// redirect_stderr_to_file redirects stderr to a file.
fn redirect_stderr_to_file(log_dir: PathBuf) {
let log_path = log_dir.join("stderr.log");
let file = OpenOptions::new()
.create(true)
.append(true)
.open(log_path)
.unwrap();

unsafe {
libc::dup2(file.as_raw_fd(), libc::STDERR_FILENO);
}
}

0 comments on commit 9ce4632

Please sign in to comment.