diff --git a/internal/fs/file.go b/internal/fs/file.go index d1b52ab..cde9ae7 100644 --- a/internal/fs/file.go +++ b/internal/fs/file.go @@ -11,10 +11,10 @@ import ( models "github.com/pojntfx/stfs/internal/db/sqlite/models/metadata" "github.com/pojntfx/stfs/internal/ioext" - "github.com/pojntfx/stfs/internal/logging" "github.com/pojntfx/stfs/pkg/cache" "github.com/pojntfx/stfs/pkg/config" "github.com/pojntfx/stfs/pkg/inventory" + "github.com/pojntfx/stfs/pkg/logging" "github.com/pojntfx/stfs/pkg/operations" "github.com/spf13/afero" ) @@ -54,7 +54,7 @@ type File struct { cleanWriteBuf func() error onHeader func(hdr *models.Header) - log *logging.JSONLogger + log logging.StructuredLogger } func NewFile( @@ -75,7 +75,7 @@ func NewFile( info os.FileInfo, onHeader func(hdr *models.Header), - log *logging.JSONLogger, + log logging.StructuredLogger, ) *File { return &File{ readOps: readOps, diff --git a/internal/fs/fileinfo.go b/internal/fs/fileinfo.go index 110b349..1db9780 100644 --- a/internal/fs/fileinfo.go +++ b/internal/fs/fileinfo.go @@ -6,7 +6,7 @@ import ( "os" "time" - "github.com/pojntfx/stfs/internal/logging" + "github.com/pojntfx/stfs/pkg/logging" ) type FileInfo struct { @@ -18,7 +18,7 @@ type FileInfo struct { modTime time.Time isDir bool - log *logging.JSONLogger + log logging.StructuredLogger } func NewFileInfo( @@ -28,7 +28,7 @@ func NewFileInfo( modTime time.Time, isDir bool, - log *logging.JSONLogger, + log logging.StructuredLogger, ) *FileInfo { return &FileInfo{ name: name, @@ -44,7 +44,7 @@ func NewFileInfo( func NewFileInfoFromTarHeader( hdr *tar.Header, - log *logging.JSONLogger, + log logging.StructuredLogger, ) *FileInfo { return &FileInfo{ name: hdr.FileInfo().Name(), diff --git a/pkg/fs/filesystem.go b/pkg/fs/filesystem.go index 039c0d8..18fea8f 100644 --- a/pkg/fs/filesystem.go +++ b/pkg/fs/filesystem.go @@ -14,10 +14,10 @@ import ( models "github.com/pojntfx/stfs/internal/db/sqlite/models/metadata" ifs "github.com/pojntfx/stfs/internal/fs" - "github.com/pojntfx/stfs/internal/logging" "github.com/pojntfx/stfs/pkg/cache" "github.com/pojntfx/stfs/pkg/config" "github.com/pojntfx/stfs/pkg/inventory" + "github.com/pojntfx/stfs/pkg/logging" "github.com/pojntfx/stfs/pkg/operations" "github.com/spf13/afero" ) @@ -35,7 +35,7 @@ type STFS struct { ioLock sync.Mutex onHeader func(hdr *models.Header) - log *logging.JSONLogger + log logging.StructuredLogger } func NewSTFS( @@ -49,7 +49,7 @@ func NewSTFS( ignorePermissionFlags bool, onHeader func(hdr *models.Header), - log *logging.JSONLogger, + log logging.StructuredLogger, ) *STFS { return &STFS{ readOps: readOps, diff --git a/pkg/logging/structured.go b/pkg/logging/structured.go new file mode 100644 index 0000000..1dc42ca --- /dev/null +++ b/pkg/logging/structured.go @@ -0,0 +1,11 @@ +package logging + +import ( + golog "github.com/fclairamb/go-log" +) + +type StructuredLogger interface { + golog.Logger + + Trace(event string, keyvals ...interface{}) +}