improved logging

This commit is contained in:
ston1th 2022-09-19 22:52:40 +02:00
commit 05b41cedce
81 changed files with 9802 additions and 279 deletions

View file

@ -4,13 +4,14 @@ package fs
import (
"errors"
"git.giftfish.de/ston1th/docstore/pkg/core"
"git.giftfish.de/ston1th/docstore/pkg/log"
"os"
"path/filepath"
"sort"
"strings"
"sync"
"git.giftfish.de/ston1th/docstore/pkg/core"
"github.com/go-logr/logr"
)
const (
@ -32,7 +33,7 @@ type Filesystem struct {
scan map[string]struct{}
}
func NewFilesystem(base string) (fs *Filesystem, err error) {
func NewFilesystem(log logr.Logger, base string) (fs *Filesystem, err error) {
if !filepath.IsAbs(base) {
err = errors.New("base dir '" + base + "' is not an absolute path")
return
@ -43,7 +44,7 @@ func NewFilesystem(base string) (fs *Filesystem, err error) {
if err != nil {
return
}
log.Printf("fs: created data directory '%s'", base)
log.Info("created data directory", "dir", base)
fi, err = os.Stat(base)
if err != nil {
return