Skip to content

Commit

Permalink
fix: use info as default log level for cdk (#4286)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraidev authored Dec 9, 2024
1 parent af91c88 commit 56af9f9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions crates/fluvio-connector-deployer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ description = "Deployer Fluvio Connector"
[dependencies]
tracing = { workspace = true }
anyhow = { workspace = true }
clap = { workspace = true, features = ["std", "derive", "help", "usage", "error-context", "env", "wrap_help", "suggestions"], default-features = false }
derive_builder = { workspace = true }
enum-display = { workspace = true }

fluvio-connector-package = { workspace = true }
4 changes: 1 addition & 3 deletions crates/fluvio-connector-deployer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use derive_builder::Builder;

use fluvio_connector_package::metadata::ConnectorMetadata;

const DEFAULT_LOG_LEVEL: &str = "info";

pub use local::LogLevel;

#[derive(Clone)]
Expand All @@ -30,7 +28,7 @@ pub struct Deployment {
pub config: PathBuf, // Configuration to pass along,
pub pkg: ConnectorMetadata, // Connector pkg definition
pub deployment_type: DeploymentType, // deployment type
#[builder(default = "DEFAULT_LOG_LEVEL.to_string()")]
#[builder(default)]
pub log_level: LogLevel, // log level
}

Expand Down
16 changes: 14 additions & 2 deletions crates/fluvio-connector-deployer/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@ use std::path::Path;
use std::process::{Command, Stdio};

use anyhow::{Context, Result};
use clap::ValueEnum;
use enum_display::EnumDisplay;
use tracing::debug;

use crate::Deployment;

pub type LogLevel = String;
#[derive(ValueEnum, Debug, Clone, PartialEq, Eq, Default, EnumDisplay)]
#[clap(rename_all = "kebab-case")]
#[enum_display(case = "Kebab")]
pub enum LogLevel {
Trace,
Debug,
#[default]
Info,
Warn,
Error,
}

pub(crate) fn deploy_local<P: AsRef<Path>>(
deployment: &Deployment,
Expand All @@ -29,7 +41,7 @@ pub(crate) fn deploy_local<P: AsRef<Path>>(
debug!("running executable: {}", &executable.to_string_lossy());
let mut cmd = Command::new(executable);

cmd.env("RUST_LOG", &deployment.log_level);
cmd.env("RUST_LOG", deployment.log_level.to_string());
cmd.stdin(Stdio::null());
cmd.stdout(stdout);
cmd.stderr(stderr);
Expand Down

0 comments on commit 56af9f9

Please sign in to comment.