refactor: add zap logger
This commit is contained in:
parent
0a90ff6439
commit
748cac542e
2
main.go
2
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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue