refactor: use zap as logger

This commit is contained in:
0xJacky 2023-05-06 21:09:22 +08:00
parent 2831208de3
commit f305701b30
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
34 changed files with 327 additions and 175 deletions

View file

@ -1,9 +1,9 @@
package model
import (
"log"
"os"
"path/filepath"
"github.com/0xJacky/Nginx-UI/logger"
"os"
"path/filepath"
)
type ConfigBackup struct {
@ -38,12 +38,12 @@ func GetBackup(id int) (config ConfigBackup) {
func CreateBackup(path string) {
content, err := os.ReadFile(path)
if err != nil {
log.Println(err)
logger.Error(err)
}
config := ConfigBackup{Name: filepath.Base(path), FilePath: path, Content: string(content)}
result := db.Create(&config)
if result.Error != nil {
log.Println(result.Error)
logger.Error(result.Error)
}
}