diff --git a/fxevent/console.go b/fxevent/console.go index b22ff1af5..cb777cb32 100644 --- a/fxevent/console.go +++ b/fxevent/console.go @@ -65,7 +65,7 @@ func (l *ConsoleLogger) LogEvent(event Event) { } else if e.ModuleName != "" { l.logf("SUPPLY\t%v from module %q", e.TypeName, e.ModuleName) } else { - l.logf("SUPPLY\t%v", e.TypeName, e.ModuleName) + l.logf("SUPPLY\t%v", e.TypeName) } case *Provided: for _, rtype := range e.OutputTypeNames { diff --git a/fxevent/console_test.go b/fxevent/console_test.go index 0e95ce419..7cae13186 100644 --- a/fxevent/console_test.go +++ b/fxevent/console_test.go @@ -137,6 +137,11 @@ func TestConsoleLogger(t *testing.T) { }, { name: "Supplied", + give: &Supplied{TypeName: "*bytes.Buffer"}, + want: "[Fx] SUPPLY *bytes.Buffer\n", + }, + { + name: "Supplied with module", give: &Supplied{TypeName: "*bytes.Buffer", ModuleName: "myModule"}, want: "[Fx] SUPPLY *bytes.Buffer from module \"myModule\"\n", }, @@ -152,6 +157,14 @@ func TestConsoleLogger(t *testing.T) { }, { name: "Provided", + give: &Provided{ + ConstructorName: "bytes.NewBuffer()", + OutputTypeNames: []string{"*bytes.Buffer"}, + }, + want: "[Fx] PROVIDE *bytes.Buffer <= bytes.NewBuffer()\n", + }, + { + name: "Provided with module", give: &Provided{ ConstructorName: "bytes.NewBuffer()", ModuleName: "myModule", @@ -161,6 +174,13 @@ func TestConsoleLogger(t *testing.T) { }, { name: "Replaced", + give: &Replaced{ + OutputTypeNames: []string{"*bytes.Buffer"}, + }, + want: "[Fx] REPLACE *bytes.Buffer\n", + }, + { + name: "Replaced with module", give: &Replaced{ ModuleName: "myModule", OutputTypeNames: []string{"*bytes.Buffer"}, @@ -174,6 +194,14 @@ func TestConsoleLogger(t *testing.T) { }, { name: "Decorated", + give: &Decorated{ + DecoratorName: "bytes.NewBuffer()", + OutputTypeNames: []string{"*bytes.Buffer"}, + }, + want: "[Fx] DECORATE *bytes.Buffer <= bytes.NewBuffer()\n", + }, + { + name: "Decorated with module", give: &Decorated{ DecoratorName: "bytes.NewBuffer()", ModuleName: "myModule", @@ -196,6 +224,14 @@ func TestConsoleLogger(t *testing.T) { give: &Invoking{FunctionName: "bytes.NewBuffer()"}, want: "[Fx] INVOKE bytes.NewBuffer()\n", }, + { + name: "Invoking with module", + give: &Invoking{ + FunctionName: "bytes.NewBuffer()", + ModuleName: "myModule", + }, + want: "[Fx] INVOKE bytes.NewBuffer() from module \"myModule\"\n", + }, { name: "Invoked/Error", give: &Invoked{