Add hclog adapter and gating to eventer (#1915)

This contains to related things:

1. An adapter allowing an hclog interface to take in information and send them to the eventer
2. A gate on the eventer, which is the analogue to the behavior prior to eventing where we'd ensure logs were not printed prior to the startup information. Without this, plugin logs using the hclog adapter will start showing up too early.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2022-03-16 17:25:34 -04:00
1 parent 7eb29261b2
commit e596daf34d
17 files changed
+879 -53

No files matched your search

+6 -2
View File
@@ -164,7 +164,8 @@ func (c *Command) Run(args []string) int {
if err := c.SetupEventing(c.Logger,
c.StderrLock,
strings.Join(serverNames, "/"),
base.WithEventerConfig(c.Config.Eventing)); err != nil {
base.WithEventerConfig(c.Config.Eventing),
base.WithEventGating(true)); err != nil {
c.UI.Error(err.Error())
return base.CommandUserError
}
@@ -447,7 +448,10 @@ func (c *Command) Run(args []string) int {
}()
c.PrintInfo(c.UI)
c.ReleaseLogGate()
if err := c.ReleaseLogGate(); err != nil {
c.UI.Error(fmt.Errorf("Error releasing event gate: %w", err).Error())
return base.CommandCliError
}
if c.Config.Controller != nil {
c.EnabledPlugins = append(c.EnabledPlugins, base.EnabledPluginHostAws, base.EnabledPluginHostAzure)