Skip to content

Commit 2fed801

Browse files
committed
chore: use correct logger in import logic
1 parent 0d88fba commit 2fed801

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

pkg/composableschemadsl/compiler/importer.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import (
66
"path/filepath"
77
"strings"
88

9-
"github.com/rs/zerolog/log"
10-
9+
"github.com/authzed/spicedb/internal/logging"
1110
"github.com/authzed/spicedb/pkg/composableschemadsl/input"
1211
)
1312

@@ -21,7 +20,7 @@ func importFile(fsys fs.FS, filePath string) (*dslNode, error) {
2120
if err != nil {
2221
return nil, fmt.Errorf("failed to read import in schema file: %w", err)
2322
}
24-
log.Trace().Str("schema", string(schemaBytes)).Str("file", filePath).Msg("read schema from file")
23+
logging.Trace().Str("schema", string(schemaBytes)).Str("file", filePath).Msg("read schema from file")
2524

2625
parsedSchema, _, err := parseSchema(InputSchema{
2726
Source: input.Source(filePath),

pkg/composableschemadsl/compiler/translator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111

1212
"github.com/ccoveille/go-safecast/v2"
1313
"github.com/jzelinskie/stringz"
14-
"github.com/rs/zerolog/log"
1514

15+
"github.com/authzed/spicedb/internal/logging"
1616
"github.com/authzed/spicedb/pkg/caveats"
1717
caveattypes "github.com/authzed/spicedb/pkg/caveats/types"
1818
"github.com/authzed/spicedb/pkg/composableschemadsl/dslshape"
@@ -85,7 +85,7 @@ func translate(tctx *translationContext, root *dslNode) (*CompiledSchema, error)
8585
}
8686

8787
case dslshape.NodeTypeCaveatDefinition:
88-
log.Trace().Msg("adding caveat definition")
88+
logging.Trace().Msg("adding caveat definition")
8989
// TODO: Maybe refactor these in terms of a generic function?
9090
def, err := translateCaveatDefinition(tctx, topLevelNode)
9191
if err != nil {
@@ -106,7 +106,7 @@ func translate(tctx *translationContext, root *dslNode) (*CompiledSchema, error)
106106
orderedDefinitions = append(orderedDefinitions, def)
107107

108108
case dslshape.NodeTypeDefinition:
109-
log.Trace().Msg("adding object definition")
109+
logging.Trace().Msg("adding object definition")
110110
def, err := translateObjectDefinition(tctx, topLevelNode)
111111
if err != nil {
112112
return nil, err
@@ -817,7 +817,7 @@ func translateImports(itctx importResolutionContext, root *dslNode) error {
817817
// by not reading the schema file in and compiling a schema with an empty string.
818818
// This prevents duplicate definitions from ending up in the output, as well
819819
// as preventing circular imports.
820-
log.Debug().Str("filepath", filePath).Msg("file has already been visited in another part of the walk")
820+
logging.Debug().Str("filepath", filePath).Msg("file has already been visited in another part of the walk")
821821
continue
822822
}
823823

pkg/schemadsl/compiler/importer.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import (
66
"path/filepath"
77
"strings"
88

9-
"github.com/rs/zerolog/log"
10-
9+
"github.com/authzed/spicedb/internal/logging"
1110
"github.com/authzed/spicedb/pkg/schemadsl/input"
1211
)
1312

@@ -21,7 +20,7 @@ func importFile(fsys fs.FS, filePath string) (*dslNode, error) {
2120
if err != nil {
2221
return nil, fmt.Errorf("failed to read import in schema file %q: %w", filePath, err)
2322
}
24-
log.Trace().Str("schema", string(schemaBytes)).Str("file", filePath).Msg("read schema from file")
23+
logging.Trace().Str("schema", string(schemaBytes)).Str("file", filePath).Msg("read schema from file")
2524

2625
parsedSchema, _, err := parseSchema(InputSchema{
2726
Source: input.Source(filePath),

pkg/schemadsl/compiler/translator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111

1212
"github.com/ccoveille/go-safecast/v2"
1313
"github.com/jzelinskie/stringz"
14-
"github.com/rs/zerolog/log"
1514

15+
"github.com/authzed/spicedb/internal/logging"
1616
"github.com/authzed/spicedb/pkg/caveats"
1717
caveattypes "github.com/authzed/spicedb/pkg/caveats/types"
1818
"github.com/authzed/spicedb/pkg/genutil/mapz"
@@ -105,7 +105,7 @@ func translate(tctx *translationContext, root *dslNode) (*CompiledSchema, error)
105105
orderedDefinitions = append(orderedDefinitions, def)
106106

107107
case dslshape.NodeTypeDefinition:
108-
log.Trace().Msg("adding object definition")
108+
logging.Trace().Msg("adding object definition")
109109
def, err := translateObjectDefinition(tctx, topLevelNode)
110110
if err != nil {
111111
return nil, err
@@ -859,7 +859,7 @@ func translateImports(itctx importResolutionContext, root *dslNode) error {
859859
// by not reading the schema file in and compiling a schema with an empty string.
860860
// This prevents duplicate definitions from ending up in the output, as well
861861
// as preventing circular imports.
862-
log.Debug().Str("filepath", filePath).Msg("file has already been visited in another part of the walk")
862+
logging.Debug().Str("filepath", filePath).Msg("file has already been visited in another part of the walk")
863863
continue
864864
}
865865

0 commit comments

Comments
 (0)