Skip to content

Commit

Permalink
merge: #2650
Browse files Browse the repository at this point in the history
2650: feat(si): Enable the use of debug logs for veritech SI container r=fnichol a=stack72

```
si --with-function-debug-logs start
```


Co-authored-by: stack72 <[email protected]>
  • Loading branch information
si-bors-ng[bot] and stack72 authored Aug 18, 2023
2 parents ee13f13 + af2d9e2 commit 9629dfb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/si/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ pub(crate) struct Args {
/// usage of that location.
#[arg(long, env = "SI_DOCKER_SOCK")]
pub docker_sock: Option<String>,
/// Enable debug logs for function executions via veritech
#[clap(long)]
pub with_function_debug_logs: bool,
#[command(subcommand)]
pub(crate) command: Commands,
}
Expand Down
1 change: 1 addition & 0 deletions bin/si/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ async fn main() -> Result<()> {
is_preview,
web_host,
web_port,
args.with_function_debug_logs,
);

println!(
Expand Down
3 changes: 3 additions & 0 deletions lib/si-cli/src/cmd/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ async fn invoke(app: &AppState, docker: &DockerClient, is_preview: bool) -> CliR
"SI_VERITECH__NATS__URL=nats".to_string(),
"OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4317".to_string(),
];
if app.with_function_debug_logs() {
env_vars.push("SI_LOG=debug".to_string());
}
env_vars.append(&mut veritech_credentials);
let create_opts = ContainerCreateOpts::builder()
.name(container_name.clone())
Expand Down
7 changes: 7 additions & 0 deletions lib/si-cli/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct AppState {
is_preview: bool,
web_host: String,
web_port: u32,
with_function_debug_logs: bool,
}

impl AppState {
Expand All @@ -21,6 +22,7 @@ impl AppState {
is_preview: bool,
web_host: String,
web_port: u32,
with_function_debug_logs: bool,
) -> Self {
Self {
posthog_client: posthog_client.into(),
Expand All @@ -29,6 +31,7 @@ impl AppState {
is_preview,
web_host,
web_port,
with_function_debug_logs,
}
}

Expand All @@ -40,6 +43,10 @@ impl AppState {
self.mode.deref()
}

pub fn with_function_debug_logs(&self) -> bool {
self.with_function_debug_logs
}

pub fn is_preview(&self) -> bool {
self.is_preview
}
Expand Down

0 comments on commit 9629dfb

Please sign in to comment.