Skip to content

feat: Add --log-level to tedge-write and tedge-apt-plugin#3271

Merged
Bravo555 merged 2 commits intothin-edge:mainfrom
Bravo555:improve/log-level
Nov 29, 2024
Merged

feat: Add --log-level to tedge-write and tedge-apt-plugin#3271
Bravo555 merged 2 commits intothin-edge:mainfrom
Bravo555:improve/log-level

Conversation

@Bravo555
Copy link
Copy Markdown
Member

Proposed changes

Add --log-level flag to tedge-write and tedge-apt-plugin.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
plugins/tedge_apt_plugin/src/lib.rs 38.46% 7 Missing and 1 partial ⚠️
crates/core/tedge_write/src/bin.rs 0.00% 2 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 27, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
527 0 2 527 100 1h33m26.646710999s

Comment on lines +36 to +46
#[command(flatten)]
log_args: LogConfigArgs,

/// [env: TEDGE_CONFIG_DIR, default: /etc/tedge]
#[clap(
long = "config-dir",
default_value = tedge_config::get_config_dir().into_os_string(),
hide_env_values = true,
hide_default_value = true,
)]
config_dir: Utf8PathBuf,
Copy link
Copy Markdown
Contributor

@albinsuresh albinsuresh Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @reubenmiller proposed in on of the earlier PRs, wouldn't it make sense to capture these two arguments into a common struct and use a flattened reference to it in all these concrete structs like MapperOpt, AgentOpt etc?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could put config_dir into the common struct as well, but because it's a multicall binary we'd still have to include it in Opt struct for each component and can't really put it in a single place and make all the other Opts have references to it. They have to own it directly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I may have wrongly used the word "reference" here, which caused that confusion. What I meant was to have a flattened field, something like:

    #[command(flatten)]
    common_args: CommonArgs,

and not really a "reference" to a single instance of that struct, which probably would unnecessarily complicated the code.

@Bravo555 Bravo555 enabled auto-merge November 29, 2024 09:45
@reubenmiller reubenmiller added theme:troubleshooting Theme: Troubleshooting and remote control theme:cli Theme: cli related topics labels Nov 29, 2024
Copy link
Copy Markdown
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, extracting the common args into a common struct and using it at one place to enable logging for all components would be attempted in a follow-up PR.

@Bravo555 Bravo555 added this pull request to the merge queue Nov 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 29, 2024
@Bravo555 Bravo555 added this pull request to the merge queue Nov 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 29, 2024
Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
@Bravo555 Bravo555 temporarily deployed to Test Pull Request November 29, 2024 12:01 — with GitHub Actions Inactive
@Bravo555 Bravo555 added this pull request to the merge queue Nov 29, 2024
Merged via the queue into thin-edge:main with commit 3b43124 Nov 29, 2024
@reubenmiller reubenmiller added this to the 1.4.0 milestone Dec 5, 2024
@reubenmiller reubenmiller changed the title Add --log-level to tedge-write and tedge-apt-plugin feat: Add --log-level to tedge-write and tedge-apt-plugin Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:cli Theme: cli related topics theme:troubleshooting Theme: Troubleshooting and remote control

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants