diff --git a/.changes/unreleased/Added-20240405-090340.yaml b/.changes/unreleased/Added-20240405-090340.yaml new file mode 100644 index 00000000..bb89bbfc --- /dev/null +++ b/.changes/unreleased/Added-20240405-090340.yaml @@ -0,0 +1,3 @@ +kind: Added +body: Added option to quiet log outputs +time: 2024-04-05T09:03:40.705290796+02:00 diff --git a/docs/src/reference/cli/mach-composer.md b/docs/src/reference/cli/mach-composer.md index 9545c4d3..a78963d0 100644 --- a/docs/src/reference/cli/mach-composer.md +++ b/docs/src/reference/cli/mach-composer.md @@ -10,7 +10,8 @@ MACH composer is a framework that you use to orchestrate and extend modern digit ``` -h, --help help for mach-composer - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_apply.md b/docs/src/reference/cli/mach-composer_apply.md index 48db05d8..dfc8f137 100644 --- a/docs/src/reference/cli/mach-composer_apply.md +++ b/docs/src/reference/cli/mach-composer_apply.md @@ -26,7 +26,8 @@ mach-composer apply [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud.md b/docs/src/reference/cli/mach-composer_cloud.md index 9a85e18b..b27b9fc3 100644 --- a/docs/src/reference/cli/mach-composer_cloud.md +++ b/docs/src/reference/cli/mach-composer_cloud.md @@ -15,7 +15,8 @@ mach-composer cloud [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_add-organization-user.md b/docs/src/reference/cli/mach-composer_cloud_add-organization-user.md index efd25621..75febf76 100644 --- a/docs/src/reference/cli/mach-composer_cloud_add-organization-user.md +++ b/docs/src/reference/cli/mach-composer_cloud_add-organization-user.md @@ -16,7 +16,8 @@ mach-composer cloud add-organization-user [email-address] [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_config.md b/docs/src/reference/cli/mach-composer_cloud_config.md index 6b873bd9..8890ff74 100644 --- a/docs/src/reference/cli/mach-composer_cloud_config.md +++ b/docs/src/reference/cli/mach-composer_cloud_config.md @@ -19,7 +19,8 @@ mach-composer cloud config [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_create-api-client.md b/docs/src/reference/cli/mach-composer_cloud_create-api-client.md index f117296d..24b639ee 100644 --- a/docs/src/reference/cli/mach-composer_cloud_create-api-client.md +++ b/docs/src/reference/cli/mach-composer_cloud_create-api-client.md @@ -17,7 +17,8 @@ mach-composer cloud create-api-client [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_create-component.md b/docs/src/reference/cli/mach-composer_cloud_create-component.md index 5b01a5e4..3e642a4d 100644 --- a/docs/src/reference/cli/mach-composer_cloud_create-component.md +++ b/docs/src/reference/cli/mach-composer_cloud_create-component.md @@ -17,7 +17,8 @@ mach-composer cloud create-component [name] [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_create-organization.md b/docs/src/reference/cli/mach-composer_cloud_create-organization.md index 0b068b47..7d452e1a 100644 --- a/docs/src/reference/cli/mach-composer_cloud_create-organization.md +++ b/docs/src/reference/cli/mach-composer_cloud_create-organization.md @@ -17,7 +17,8 @@ mach-composer cloud create-organization [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_create-project.md b/docs/src/reference/cli/mach-composer_cloud_create-project.md index 0bb94868..56706da5 100644 --- a/docs/src/reference/cli/mach-composer_cloud_create-project.md +++ b/docs/src/reference/cli/mach-composer_cloud_create-project.md @@ -16,7 +16,8 @@ mach-composer cloud create-project [key] [name] [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_describe-component-versions.md b/docs/src/reference/cli/mach-composer_cloud_describe-component-versions.md index 6d5ff9cc..e7e9e9dc 100644 --- a/docs/src/reference/cli/mach-composer_cloud_describe-component-versions.md +++ b/docs/src/reference/cli/mach-composer_cloud_describe-component-versions.md @@ -17,7 +17,8 @@ mach-composer cloud describe-component-versions [name] [version] [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_list-api-clients.md b/docs/src/reference/cli/mach-composer_cloud_list-api-clients.md index 6f2aca35..b7b88527 100644 --- a/docs/src/reference/cli/mach-composer_cloud_list-api-clients.md +++ b/docs/src/reference/cli/mach-composer_cloud_list-api-clients.md @@ -17,7 +17,8 @@ mach-composer cloud list-api-clients [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_list-component-versions.md b/docs/src/reference/cli/mach-composer_cloud_list-component-versions.md index b1451804..398db4ea 100644 --- a/docs/src/reference/cli/mach-composer_cloud_list-component-versions.md +++ b/docs/src/reference/cli/mach-composer_cloud_list-component-versions.md @@ -17,7 +17,8 @@ mach-composer cloud list-component-versions [name] [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_list-components.md b/docs/src/reference/cli/mach-composer_cloud_list-components.md index 97c69c88..e4011f17 100644 --- a/docs/src/reference/cli/mach-composer_cloud_list-components.md +++ b/docs/src/reference/cli/mach-composer_cloud_list-components.md @@ -17,7 +17,8 @@ mach-composer cloud list-components [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_list-organization-users.md b/docs/src/reference/cli/mach-composer_cloud_list-organization-users.md index 42cbceb1..5590d075 100644 --- a/docs/src/reference/cli/mach-composer_cloud_list-organization-users.md +++ b/docs/src/reference/cli/mach-composer_cloud_list-organization-users.md @@ -16,7 +16,8 @@ mach-composer cloud list-organization-users [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_list-organizations.md b/docs/src/reference/cli/mach-composer_cloud_list-organizations.md index f91c3303..d5ee1502 100644 --- a/docs/src/reference/cli/mach-composer_cloud_list-organizations.md +++ b/docs/src/reference/cli/mach-composer_cloud_list-organizations.md @@ -15,7 +15,8 @@ mach-composer cloud list-organizations [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_list-projects.md b/docs/src/reference/cli/mach-composer_cloud_list-projects.md index 10e3d199..5677b413 100644 --- a/docs/src/reference/cli/mach-composer_cloud_list-projects.md +++ b/docs/src/reference/cli/mach-composer_cloud_list-projects.md @@ -16,7 +16,8 @@ mach-composer cloud list-projects [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_login.md b/docs/src/reference/cli/mach-composer_cloud_login.md index 93b779db..e4734e0e 100644 --- a/docs/src/reference/cli/mach-composer_cloud_login.md +++ b/docs/src/reference/cli/mach-composer_cloud_login.md @@ -15,7 +15,8 @@ mach-composer cloud login [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_register-component-version.md b/docs/src/reference/cli/mach-composer_cloud_register-component-version.md index b77a36e6..4fbd4fce 100644 --- a/docs/src/reference/cli/mach-composer_cloud_register-component-version.md +++ b/docs/src/reference/cli/mach-composer_cloud_register-component-version.md @@ -20,7 +20,8 @@ mach-composer cloud register-component-version [name] [version] [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_cloud_update-component.md b/docs/src/reference/cli/mach-composer_cloud_update-component.md index cf61eb62..a256f91f 100644 --- a/docs/src/reference/cli/mach-composer_cloud_update-component.md +++ b/docs/src/reference/cli/mach-composer_cloud_update-component.md @@ -18,7 +18,8 @@ mach-composer cloud update-component [key] [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_components.md b/docs/src/reference/cli/mach-composer_components.md index fb2ee189..edfddd9c 100644 --- a/docs/src/reference/cli/mach-composer_components.md +++ b/docs/src/reference/cli/mach-composer_components.md @@ -21,7 +21,8 @@ mach-composer components [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_generate.md b/docs/src/reference/cli/mach-composer_generate.md index b7506848..a8100227 100644 --- a/docs/src/reference/cli/mach-composer_generate.md +++ b/docs/src/reference/cli/mach-composer_generate.md @@ -21,7 +21,8 @@ mach-composer generate [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_graph.md b/docs/src/reference/cli/mach-composer_graph.md index d39eba75..f86b4f21 100644 --- a/docs/src/reference/cli/mach-composer_graph.md +++ b/docs/src/reference/cli/mach-composer_graph.md @@ -35,7 +35,8 @@ mach-composer graph [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_init.md b/docs/src/reference/cli/mach-composer_init.md index b71266a2..e350b87a 100644 --- a/docs/src/reference/cli/mach-composer_init.md +++ b/docs/src/reference/cli/mach-composer_init.md @@ -21,7 +21,8 @@ mach-composer init [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_plan.md b/docs/src/reference/cli/mach-composer_plan.md index a6572328..bc35c26d 100644 --- a/docs/src/reference/cli/mach-composer_plan.md +++ b/docs/src/reference/cli/mach-composer_plan.md @@ -25,7 +25,8 @@ mach-composer plan [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_schema.md b/docs/src/reference/cli/mach-composer_schema.md index 130ae645..c8088645 100644 --- a/docs/src/reference/cli/mach-composer_schema.md +++ b/docs/src/reference/cli/mach-composer_schema.md @@ -16,7 +16,8 @@ mach-composer schema [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_show-plan.md b/docs/src/reference/cli/mach-composer_show-plan.md index 425553aa..7ddb5aa3 100644 --- a/docs/src/reference/cli/mach-composer_show-plan.md +++ b/docs/src/reference/cli/mach-composer_show-plan.md @@ -24,7 +24,8 @@ mach-composer show-plan [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_sites.md b/docs/src/reference/cli/mach-composer_sites.md index 4bdd6685..24b736d8 100644 --- a/docs/src/reference/cli/mach-composer_sites.md +++ b/docs/src/reference/cli/mach-composer_sites.md @@ -21,7 +21,8 @@ mach-composer sites [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_terraform.md b/docs/src/reference/cli/mach-composer_terraform.md index fdd740ff..453df9ff 100644 --- a/docs/src/reference/cli/mach-composer_terraform.md +++ b/docs/src/reference/cli/mach-composer_terraform.md @@ -22,7 +22,8 @@ mach-composer terraform [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_update.md b/docs/src/reference/cli/mach-composer_update.md index 43c28175..1c9f7ce2 100644 --- a/docs/src/reference/cli/mach-composer_update.md +++ b/docs/src/reference/cli/mach-composer_update.md @@ -21,7 +21,8 @@ mach-composer update [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/docs/src/reference/cli/mach-composer_version.md b/docs/src/reference/cli/mach-composer_version.md index ba8007b0..8756eda5 100644 --- a/docs/src/reference/cli/mach-composer_version.md +++ b/docs/src/reference/cli/mach-composer_version.md @@ -15,7 +15,8 @@ mach-composer version [flags] ### Options inherited from parent commands ``` - --verbose Verbose output. + -q, --quiet Quiet output. This is equal to setting log levels to error and higher + -v, --verbose Verbose output. This is equal to setting log levels to debug and higher ``` ### SEE ALSO diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 9a28e5ae..1422fdb8 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -27,9 +27,16 @@ var ( panic(err) } + quiet, err := cmd.Flags().GetBool("quiet") + if err != nil { + panic(err) + } + logger := zerolog.New(os.Stdout) if verbose { logger = logger.Level(zerolog.TraceLevel) + } else if quiet { + logger = logger.Level(zerolog.ErrorLevel) } else { logger = logger.Level(zerolog.InfoLevel) } @@ -58,7 +65,8 @@ var ( ) func init() { - RootCmd.PersistentFlags().BoolP("verbose", "", false, "Verbose output.") + RootCmd.PersistentFlags().BoolP("verbose", "v", false, "Verbose output. This is equal to setting log levels to debug and higher") + RootCmd.PersistentFlags().BoolP("quiet", "q", false, "Quiet output. This is equal to setting log levels to error and higher") RootCmd.AddCommand(applyCmd) RootCmd.AddCommand(cloudcmd.CloudCmd) RootCmd.AddCommand(componentsCmd)