fix: use utils.Log in some places

This commit is contained in:
Noah Hsu
2022-08-30 16:13:01 +08:00
parent 615e5dd118
commit a6b9dbfbe4
7 changed files with 15 additions and 18 deletions

View File

@ -1,12 +1,11 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"github.com/alist-org/alist/v3/internal/db"
log "github.com/sirupsen/logrus"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/spf13/cobra"
)
@ -18,11 +17,11 @@ var cancel2FACmd = &cobra.Command{
Init()
admin, err := db.GetAdmin()
if err != nil {
log.Errorf("failed to get admin user: %+v", err)
utils.Log.Errorf("failed to get admin user: %+v", err)
} else {
err := db.Cancel2FAByUser(admin)
if err != nil {
log.Errorf("failed to cancel 2FA: %+v", err)
utils.Log.Errorf("failed to cancel 2FA: %+v", err)
}
}
},

View File

@ -9,10 +9,8 @@ import (
"os"
"strings"
"github.com/alist-org/alist/v3/internal/bootstrap/data"
log "github.com/sirupsen/logrus"
_ "github.com/alist-org/alist/v3/drivers"
"github.com/alist-org/alist/v3/internal/bootstrap/data"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/pkg/utils"
@ -90,7 +88,7 @@ var langCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
err := os.MkdirAll("lang", 0777)
if err != nil {
log.Fatal("failed create folder: %s", err.Error())
utils.Log.Fatal("failed create folder: %s", err.Error())
}
generateDriversJson()
generateSettingsJson()

View File

@ -1,12 +1,11 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"github.com/alist-org/alist/v3/internal/db"
log "github.com/sirupsen/logrus"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/spf13/cobra"
)
@ -18,9 +17,9 @@ var passwordCmd = &cobra.Command{
Init()
admin, err := db.GetAdmin()
if err != nil {
log.Errorf("failed get admin user: %+v", err)
utils.Log.Errorf("failed get admin user: %+v", err)
} else {
log.Infof("admin user's password is: %s", admin.Password)
utils.Log.Infof("admin user's password is: %s", admin.Password)
}
},
}

View File

@ -48,7 +48,7 @@ the address is defined in config file`,
err = srv.ListenAndServe()
}
if err != nil && err != http.ErrServerClosed {
utils.Log.Errorf("failed to start: %s", err.Error())
utils.Log.Fatalf("failed to start: %s", err.Error())
}
}()
// Wait for interrupt signal to gracefully shutdown the server with