Skip to content

Commit

Permalink
A little more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
marccampbell committed Mar 21, 2020
1 parent e7776f8 commit 768e1dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 0 additions & 2 deletions pkg/controller/table/table_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package table

import (
"context"
"fmt"
"time"

"github.com/pkg/errors"
Expand Down Expand Up @@ -104,7 +103,6 @@ type ReconcileTable struct {
func (r *ReconcileTable) Reconcile(request reconcile.Request) (reconcile.Result, error) {
instance, instanceErr := r.getInstance(request)
if instanceErr == nil {
fmt.Printf("instance\n")
result, err := r.reconcileInstance(instance)
if err != nil {
logger.Error(err)
Expand Down
5 changes: 4 additions & 1 deletion pkg/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
schemasv1alpha3 "github.com/schemahero/schemahero/pkg/apis/schemas/v1alpha3"
"github.com/schemahero/schemahero/pkg/database/mysql"
"github.com/schemahero/schemahero/pkg/database/postgres"
"github.com/schemahero/schemahero/pkg/logger"
"github.com/spf13/viper"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
)

Expand All @@ -26,7 +28,8 @@ func NewDatabase() *Database {
}

func (d *Database) CreateFixturesSync() error {
fmt.Printf("generating fixtures for resources in %s\n", d.Viper.GetString("input-dir"))
logger.Infof("generating fixtures",
zap.String("input-dir", d.Viper.GetString("input-dir")))

statements := []string{}
handleFile := func(path string, info os.FileInfo, err error) error {
Expand Down
6 changes: 6 additions & 0 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ func Error(err error) {
sugar.Error(err)
}

func Info(msg string, fields ...zap.Field) {
defer log.Sync()
sugar := log.Sugar()
sugar.Info(msg, fields)
}

func Infof(template string, args ...interface{}) {
defer log.Sync()
sugar := log.Sugar()
Expand Down

0 comments on commit 768e1dd

Please sign in to comment.