mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 10:55:51 +02:00
refactor: use zap as logger ⚡
This commit is contained in:
parent
2831208de3
commit
f305701b30
34 changed files with 327 additions and 175 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue