Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
specify log path
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill committed Nov 15, 2023
1 parent e4873a6 commit 884a5a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 0 additions & 4 deletions docker/runner.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,3 @@ COPY docker/.artifacts/bundle.car $FM_HOME_DIR/bundle.car
COPY docker/.artifacts/contracts $FM_HOME_DIR/contracts
COPY --from=builder /app/fendermint/app/config $FM_HOME_DIR/config
COPY --from=builder /app/output/bin/fendermint /usr/local/bin/fendermint

RUN useradd ipc && chown -R ipc $FM_HOME_DIR

USER ipc
4 changes: 4 additions & 0 deletions fendermint/app/options/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ pub struct Options {
)]
pub home_dir: PathBuf,

/// Set a custom directory for ipc log files.
#[arg(short = 'd', long, default_value = "/tmp/ipc/logs", env = "FM_LOG_DIR")]
pub log_dir: PathBuf,

/// Optionally override the default configuration.
#[arg(short, long, default_value = "dev")]
pub mode: String,
Expand Down
7 changes: 3 additions & 4 deletions fendermint/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async fn main() {

// Log events to stdout.
if let Some(level) = opts.tracing_level() {
create_log(level, &opts.home_dir).expect("cannot create logging");
create_log(level, &opts.log_dir).expect("cannot create logging");
}

if let Err(e) = cmd::exec(&opts).await {
Expand All @@ -32,9 +32,8 @@ async fn main() {
}
}

fn create_log(level: tracing::Level, home_dir: &Path) -> anyhow::Result<()> {
let log_folder = expand_tilde(home_dir)
.join("logs")
fn create_log(level: tracing::Level, log_dir: &Path) -> anyhow::Result<()> {
let log_folder = expand_tilde(log_dir)
.to_str()
.ok_or_else(|| anyhow!("cannot parse log folder"))?
.to_string();
Expand Down

0 comments on commit 884a5a2

Please sign in to comment.