Merge pull request #275 from hashicorp/debug-flags

Debug flags
This commit is contained in:
Sophia Castellarin 2022-05-24 12:14:53 -05:00 committed by GitHub
commit e2bd70bb77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

2
go.mod
View File

@ -45,7 +45,7 @@ require (
github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl/v2 v2.7.1-0.20201023000745-3de61ecba298 github.com/hashicorp/hcl/v2 v2.7.1-0.20201023000745-3de61ecba298
github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220524143129-870b4d92ef7f github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220524143830-80e9a67614d0
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
github.com/imdario/mergo v0.3.11 github.com/imdario/mergo v0.3.11
github.com/improbable-eng/grpc-web v0.13.0 github.com/improbable-eng/grpc-web v0.13.0

4
go.sum
View File

@ -357,8 +357,8 @@ github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d h1:afuZ/KNbxwU
github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d/go.mod h1:DCi2k47yuUDzf2qWAK8E1RVmWgz/lc0jZQeEnICTxmY= github.com/hashicorp/nomad/api v0.0.0-20200814140818-42de70466a9d/go.mod h1:DCi2k47yuUDzf2qWAK8E1RVmWgz/lc0jZQeEnICTxmY=
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220513172229-62750f6e1ce7 h1:4d/nNs0gKLHkm9Ra/bdQTvxWSz0ctvwaOUFrZD/4pN4= github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220513172229-62750f6e1ce7 h1:4d/nNs0gKLHkm9Ra/bdQTvxWSz0ctvwaOUFrZD/4pN4=
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220513172229-62750f6e1ce7/go.mod h1:KWfWOiotOWKiAqdroXVc7GUFnuOzlzhnRkGTV9Js7/s= github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220513172229-62750f6e1ce7/go.mod h1:KWfWOiotOWKiAqdroXVc7GUFnuOzlzhnRkGTV9Js7/s=
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220524143129-870b4d92ef7f h1:AMB9Q7BMRH8f+pUzpND+6EAnPCYglLa83Rn7sKC3m74= github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220524143830-80e9a67614d0 h1:oHSg3GwN9Wk4Fa94Ozx9et+hUesiPe4bdjyp0uIv5Qo=
github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220524143129-870b4d92ef7f/go.mod h1:KWfWOiotOWKiAqdroXVc7GUFnuOzlzhnRkGTV9Js7/s= github.com/hashicorp/vagrant-plugin-sdk v0.0.0-20220524143830-80e9a67614d0/go.mod h1:KWfWOiotOWKiAqdroXVc7GUFnuOzlzhnRkGTV9Js7/s=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce h1:7UnVY3T/ZnHUrfviiAgIUjg2PXxsQfs5bphsG8F7Keo= github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce h1:7UnVY3T/ZnHUrfviiAgIUjg2PXxsQfs5bphsG8F7Keo=
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=

View File

@ -18,6 +18,7 @@ import (
"github.com/mitchellh/go-glint" "github.com/mitchellh/go-glint"
"github.com/hashicorp/vagrant-plugin-sdk/internal-shared/protomappers" "github.com/hashicorp/vagrant-plugin-sdk/internal-shared/protomappers"
"github.com/hashicorp/vagrant-plugin-sdk/localizer"
"github.com/hashicorp/vagrant-plugin-sdk/proto/vagrant_plugin_sdk" "github.com/hashicorp/vagrant-plugin-sdk/proto/vagrant_plugin_sdk"
"github.com/hashicorp/vagrant-plugin-sdk/terminal" "github.com/hashicorp/vagrant-plugin-sdk/terminal"
"github.com/hashicorp/vagrant/internal/pkg/signalcontext" "github.com/hashicorp/vagrant/internal/pkg/signalcontext"
@ -281,6 +282,25 @@ func logger(args []string) ([]string, hclog.Logger, io.Writer, error) {
_ = os.Setenv("VAGRANT_LOG", "trace") _ = os.Setenv("VAGRANT_LOG", "trace")
} }
verbose = true verbose = true
case "--debug":
if level == hclog.NoLevel || level > hclog.Debug {
level = hclog.Debug
_ = os.Setenv("VAGRANT_LOG", "debug")
}
case "--timestamp":
t := terminal.NonInteractiveUI(context.Background())
t.Output(
localizer.LocalizeMsg("deprecated_flag", map[string]string{"Flag": "--timestamp"}),
)
case "--debug-timestamp":
if level == hclog.NoLevel || level > hclog.Debug {
level = hclog.Debug
_ = os.Setenv("VAGRANT_LOG", "debug")
}
t := terminal.NonInteractiveUI(context.Background())
t.Output(
localizer.LocalizeMsg("deprecated_flag", map[string]string{"Flag": "--debug-timestamp"}),
)
default: default:
outArgs = append(outArgs, arg) outArgs = append(outArgs, arg)
} }