Update logging names for clearer messages

This commit is contained in:
Chris Roberts 2021-10-13 11:39:29 -07:00 committed by Paul Hinze
parent fa27dc5c4f
commit fc61c27b51
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
4 changed files with 11 additions and 8 deletions

View File

@ -5,7 +5,7 @@ import (
"os"
"os/exec"
"runtime"
// "strings"
"strings"
"github.com/hashicorp/go-argmapper"
"github.com/hashicorp/go-hclog"
@ -35,9 +35,12 @@ func Factory(
// fields on it.
cmdCopy := *cmd
config := pluginclient.ClientConfig(log)
log = log.Named("factory")
nlog := log.ResetNamed("vagrant.plugin")
config := pluginclient.ClientConfig(nlog)
config.Cmd = &cmdCopy
config.Logger = log
config.Logger = nlog
// Log that we're going to launch this
log.Info("launching plugin",
@ -87,7 +90,7 @@ func Factory(
Name: info.Name(),
Types: info.ComponentTypes(),
components: map[component.Type]*Instance{},
logger: log,
logger: nlog.Named(info.Name()),
src: client,
}
@ -135,7 +138,7 @@ func RubyFactory(
Name: name,
Types: []component.Type{typ},
components: map[component.Type]*Instance{},
logger: log,
logger: log.ResetNamed("vagrant.legacy." + strings.ToLower(typ.String())),
}, nil
}
}

View File

@ -332,7 +332,7 @@ func (m *Manager) loadInProcessBuiltins() (err error) {
func (m *Manager) register(
factory PluginRegistration, // Function to generate plugin
) (err error) {
plg, err := factory(m.logger)
plg, err := factory(m.logger.ResetNamed("vagrant.plugin"))
if err != nil {
return
}

View File

@ -23,7 +23,7 @@ type VagrantClient struct {
}
func NewVagrantClient(ctx context.Context, log hclog.Logger, addr string) (*VagrantClient, error) {
log = log.Named("vagrant-client")
log = log.Named("vagrant.client")
conn, err := Connect(ctx,
WithAddr(addr),
)

View File

@ -33,7 +33,7 @@ type RubyVagrantClient struct {
}
func RubyVagrantPluginConfig(log hclog.Logger) *plugin.ClientConfig {
log = log.ResetNamed("vagrant.client.ruby-runtime")
log = log.ResetNamed("vagrant.legacy")
config := pluginclient.ClientConfig(log)
config.Logger = log
config.VersionedPlugins[1]["vagrantrubyruntime"] = &RubyVagrantPlugin{}