Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: remove fmt.Print (#2190)
Yilong Lie2e915204bc8
diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.goindex ca0fff0825..8e77ffea01 100644--- a/bin/server/cmd/root.go+++ b/bin/server/cmd/root.go@@ -193,7 +193,7 @@ func start() {s, err := server.NewServer(ctx, activeProfile)if err != nil {- fmt.Printf("cannot new server, error: %v\n", err)+ log.Error("Cannot new server", zap.Error(err))return}fmt.Printf(greetingBanner, fmt.Sprintf("Version %s has started at %s:%d", activeProfile.Version, activeProfile.BackendHost, activeProfile.BackendPort))diff --git a/bin/sql-service/cmd/root.go b/bin/sql-service/cmd/root.goindex a181fc73ad..5e0475f604 100644--- a/bin/sql-service/cmd/root.go+++ b/bin/sql-service/cmd/root.go@@ -126,7 +126,7 @@ func start() {s, err := server.NewServer(ctx, activeProfile)if err != nil {- fmt.Printf("Cannot new server, error: %v\n", err)+ log.Error("Cannot new server", zap.Error(err))return}fmt.Printf(greetingBanner, fmt.Sprintf("Version %s has started at %s:%d", activeProfile.Version, activeProfile.BackendHost, activeProfile.BackendPort))diff --git a/server/server.go b/server/server.goindex 9096dd8f12..59b9fd42e4 100644--- a/server/server.go+++ b/server/server.go@@ -105,17 +105,17 @@ func NewServer(ctx context.Context, prof Profile) (*Server, error) {}// Display config- fmt.Println("-----Config BEGIN-----")- fmt.Printf("mode=%s\n", prof.Mode)- fmt.Printf("server=%s:%d\n", prof.BackendHost, prof.BackendPort)- fmt.Printf("datastore=%s:%d\n", prof.BackendHost, prof.DatastorePort)- fmt.Printf("frontend=%s:%d\n", prof.FrontendHost, prof.FrontendPort)- fmt.Printf("demoDataDir=%s\n", prof.DemoDataDir)- fmt.Printf("readonly=%t\n", prof.Readonly)- fmt.Printf("demo=%t\n", prof.Demo)- fmt.Printf("debug=%t\n", prof.Debug)- fmt.Printf("dataDir=%s\n", prof.DataDir)- fmt.Println("-----Config END-------")+ log.Info("-----Config BEGIN-----")+ log.Info(fmt.Sprintf("mode=%s", prof.Mode))+ log.Info(fmt.Sprintf("server=%s:%d", prof.BackendHost, prof.BackendPort))+ log.Info(fmt.Sprintf("datastore=%s:%d", prof.BackendHost, prof.DatastorePort))+ log.Info(fmt.Sprintf("frontend=%s:%d", prof.FrontendHost, prof.FrontendPort))+ log.Info(fmt.Sprintf("demoDataDir=%s", prof.DemoDataDir))+ log.Info(fmt.Sprintf("readonly=%t", prof.Readonly))+ log.Info(fmt.Sprintf("demo=%t", prof.Demo))+ log.Info(fmt.Sprintf("debug=%t", prof.Debug))+ log.Info(fmt.Sprintf("dataDir=%s", prof.DataDir))+ log.Info("-----Config END-------")serverStarted := falsedefer func() {@@ -138,13 +138,13 @@ func NewServer(ctx context.Context, prof Profile) (*Server, error) {pgDataDir = common.GetPostgresDataDir(prof.DataDir)}log.Info("-----Embedded Postgres Config BEGIN-----")- log.Info(fmt.Sprintf("resourceDir=%s\n", resourceDir))- log.Info(fmt.Sprintf("pgdataDir=%s\n", pgDataDir))+ log.Info(fmt.Sprintf("resourceDir=%s", resourceDir))+ log.Info(fmt.Sprintf("pgdataDir=%s", pgDataDir))log.Info("-----Embedded Postgres Config END-----")log.Info("Preparing embedded PostgreSQL instance...")// Installs the Postgres binary and creates the 'activeProfile.pgUser' user/database// to store Bytebase's own metadata.- log.Info(fmt.Sprintf("Installing Postgres OS %q Arch %q\n", runtime.GOOS, runtime.GOARCH))+ log.Info(fmt.Sprintf("Installing Postgres OS %q Arch %q", runtime.GOOS, runtime.GOARCH))pgInstance, err := postgres.Install(resourceDir, pgDataDir, prof.PgUser)if err != nil {return nil, errdiff --git a/sql-server/server.go b/sql-server/server.goindex d53ec479e8..b6424ece5f 100644--- a/sql-server/server.go+++ b/sql-server/server.go@@ -57,12 +57,12 @@ func NewServer(ctx context.Context, prof Profile) (*Server, error) {}// Display config- fmt.Println("-----Config BEGIN-----")- fmt.Printf("mode=%s\n", prof.Mode)- fmt.Printf("server=%s:%d\n", prof.BackendHost, prof.BackendPort)- fmt.Printf("debug=%t\n", prof.Debug)- fmt.Printf("workspaceID=%s\n", prof.WorkspaceID)- fmt.Println("-----Config END-------")+ log.Info("-----Config BEGIN-----")+ log.Info(fmt.Sprintf("mode=%s", prof.Mode))+ log.Info(fmt.Sprintf("server=%s:%d", prof.BackendHost, prof.BackendPort))+ log.Info(fmt.Sprintf("debug=%t", prof.Debug))+ log.Info(fmt.Sprintf("workspaceID=%s", prof.WorkspaceID))+ log.Info("-----Config END-------")serverStarted := falsedefer func() {diff --git a/tests/external_pg_test.go b/tests/external_pg_test.goindex b968d7f95f..f72d4dde22 100644--- a/tests/external_pg_test.go+++ b/tests/external_pg_test.go@@ -8,8 +8,10 @@ import ("testing""github.com/bytebase/bytebase/common"+ "github.com/bytebase/bytebase/common/log""github.com/bytebase/bytebase/resources/postgres""github.com/bytebase/bytebase/tests/fake"+ "go.uber.org/zap""github.com/stretchr/testify/require")@@ -59,7 +61,7 @@ func TestBootWithExternalPg(t *testing.T) {a.NoError(err)defer func() {if err = externalPg.Destroy(); err != nil {- fmt.Printf("cannot destroy postgres instance, error: %s", err.Error())+ log.Error("cannot destroy postgres instance", zap.Error(err))t.FailNow()}}()diff --git a/tests/tests.go b/tests/tests.goindex 94c906312f..4f3e73c40a 100644--- a/tests/tests.go+++ b/tests/tests.go@@ -285,23 +285,23 @@ func (ctl *controller) waitForHealthz() error {gURL := fmt.Sprintf("%s%s", ctl.rootURL, healthzURL)req, err := http.NewRequest(http.MethodGet, gURL, nil)if err != nil {- fmt.Printf("fail to create a new GET request(%q), error: %s", gURL, err.Error())+ log.Error("Fail to create a new GET request", zap.String("URL", gURL), zap.Error(err))continue}resp, err := ctl.client.Do(req)if err != nil {- fmt.Printf("fail to send a GET request(%q), error: %s", gURL, err.Error())+ log.Error("Fail to send a GET request", zap.String("URL", gURL), zap.Error(err))continue}if resp.StatusCode != http.StatusOK {body, err := io.ReadAll(resp.Body)if err != nil {- fmt.Printf("failed to read http response body, error: %s", err.Error())+ log.Error("Failed to read http response body", zap.Error(err))}- fmt.Printf("http response error code %v body %q", resp.StatusCode, string(body))+ log.Error("http response error", zap.Int("status_code", resp.StatusCode), zap.ByteString("body", body))continue}