Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(container)!: move logging and visualization options to DebugOption #10302

Merged
merged 8 commits into from
Oct 14, 2021
173 changes: 0 additions & 173 deletions container/config.go

This file was deleted.

6 changes: 3 additions & 3 deletions container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

type container struct {
*config
*debugConfig

resolvers map[reflect.Type]resolver

Expand All @@ -26,9 +26,9 @@ type resolveFrame struct {
typ reflect.Type
}

func newContainer(cfg *config) *container {
func newContainer(cfg *debugConfig) *container {
return &container{
config: cfg,
debugConfig: cfg,
resolvers: map[reflect.Type]resolver{},
scopes: map[string]Scope{},
callerStack: nil,
Expand Down
22 changes: 12 additions & 10 deletions container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,17 +516,19 @@ func TestLogging(t *testing.T) {
require.NoError(t, err)
defer os.Remove(graphfile.Name())

require.NoError(t, container.Run(
require.NoError(t, container.RunDebug(
func() {},
container.Logger(func(s string) {
logOut += s
}),
container.Visualizer(func(g string) {
dotGraph = g
}),
container.LogVisualizer(),
container.FileVisualizer(graphfile.Name(), "svg"),
container.StdoutLogger(),
container.DebugOptions(
container.Logger(func(s string) {
logOut += s
}),
container.Visualizer(func(g string) {
dotGraph = g
}),
container.LogVisualizer(),
container.FileVisualizer(graphfile.Name(), "svg"),
container.StdoutLogger(),
),
))

require.Contains(t, logOut, "digraph")
Expand Down
Loading