Skip to content

Commit

Permalink
feat(fmt_style): enabling fmt style selection
Browse files Browse the repository at this point in the history
Signed-off-by: Abhilash Shetty <abhilash.shetty@datacore.com>
  • Loading branch information
abhilashshetty04 committed Mar 1, 2024
1 parent d645893 commit fa81d74
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 7 additions & 2 deletions control-plane/csi-driver/src/bin/controller/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,16 @@ async fn main() -> anyhow::Result<()> {
utils::raw_version_str(),
env!("CARGO_PKG_VERSION"),
);
let fmt_style = args.get_one::<FmtStyle>("fmt-style").unwrap();
let fmt_style = args.get_one::<String>("fmt-style").unwrap().as_ref();
let fmt_style = match fmt_style {
"json" => FmtStyle::Json,
"compact" => FmtStyle::Compact,
_ => FmtStyle::Pretty,
};
let ansi_colors = args.get_flag("ansi-colors");
utils::tracing_telemetry::TracingTelemetry::builder()
.with_writer(FmtLayer::Stdout)
.with_style(*fmt_style)
.with_style(fmt_style)
.with_colours(ansi_colors)
.with_jaeger(args.get_one::<String>("jaeger").cloned())
.with_tracing_tags(tags)
Expand Down
10 changes: 7 additions & 3 deletions control-plane/csi-driver/src/bin/node/main_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,16 @@ pub(super) async fn main() -> anyhow::Result<()> {
env!("CARGO_PKG_VERSION"),
);

let fmt_style = matches.get_one::<FmtStyle>("fmt-style").unwrap();

let fmt_style = matches.get_one::<String>("fmt-style").unwrap().as_ref();
let fmt_style = match fmt_style {
"json" => FmtStyle::Json,
"compact" => FmtStyle::Compact,
_ => FmtStyle::Pretty,
};
let colors = matches.get_flag("ansi-colors");
utils::tracing_telemetry::TracingTelemetry::builder()
.with_writer(FmtLayer::Stdout)
.with_style(*fmt_style)
.with_style(fmt_style)
.with_colours(colors)
.with_tracing_tags(tags.clone())
.init("csi-node");
Expand Down
2 changes: 1 addition & 1 deletion utils/dependencies

0 comments on commit fa81d74

Please sign in to comment.