Skip to content

Conversation

@jhoward-lm
Copy link
Contributor

Description

This PR includes a small refactor to use a dynamic prefix when creating a subcommand's logger, and only call the logger instantiation from a single location in rootCmd instead of from every subcommand.

The intent is to use the first top-level subcommand's name in cases where a subcommand may have more than one nested subcommand (e.g. bomctl alias remove ..., in which case the logger prefix will be alias: instead of remove:).

Type of change

  • Refactor

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
@jhoward-lm jhoward-lm added the enhancement New feature or request label Aug 22, 2024
@jhoward-lm jhoward-lm self-assigned this Aug 22, 2024
@jhoward-lm jhoward-lm requested a review from a team as a code owner August 22, 2024 14:04
Copy link
Member

@ashearin ashearin left a comment

Choose a reason for hiding this comment

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

Awesome!

@idunbarh idunbarh merged commit 871c2d1 into main Aug 22, 2024
@idunbarh idunbarh deleted the logger-dynamic-prefix branch August 22, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants