diff --git a/main.go b/main.go index 2c482cd..21a2814 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( _ "git.lumeweb.com/LumeWeb/portal/docs" "git.lumeweb.com/LumeWeb/portal/renterd" "git.lumeweb.com/LumeWeb/portal/service/files" + "git.lumeweb.com/LumeWeb/portal/shared" "git.lumeweb.com/LumeWeb/portal/tus" "git.lumeweb.com/LumeWeb/portal/validator" "github.com/iris-contrib/swagger" @@ -48,6 +49,7 @@ func main() { renterd.Ready() + shared.Init() files.Init() // Create a new Iris app instance diff --git a/shared/shared.go b/shared/shared.go index 4c7454a..ea800ca 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -4,11 +4,15 @@ import ( "github.com/golang-queue/queue" "github.com/tus/tusd/pkg/filestore" tusd "github.com/tus/tusd/pkg/handler" + "go.uber.org/zap" + _ "go.uber.org/zap" + "log" ) var tusQueue *queue.Queue var tusStore *filestore.FileStore var tusComposer *tusd.StoreComposer +var logger *zap.Logger func SetTusQueue(q *queue.Queue) { tusQueue = q @@ -33,3 +37,17 @@ func SetTusComposer(c *tusd.StoreComposer) { func GetTusComposer() *tusd.StoreComposer { return tusComposer } + +func Init() { + newLogger, err := zap.NewProduction() + + if err != nil { + log.Fatal(err) + } + + logger = newLogger +} + +func GetLogger() *zap.Logger { + return logger +}