1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

refactor: include logging framework (resolve #92)

This commit is contained in:
Ferdinand Mütsch
2021-01-30 11:17:37 +01:00
parent fd239e4f21
commit 617d9ad7e4
16 changed files with 80 additions and 77 deletions

View File

@@ -1,10 +1,10 @@
package common
import (
"github.com/emvi/logbuch"
"github.com/muety/wakapi/config"
"github.com/muety/wakapi/models"
"gorm.io/gorm"
"log"
)
func MigrateLanguages(db *gorm.DB) {
@@ -16,10 +16,10 @@ func MigrateLanguages(db *gorm.DB) {
Where("entity LIKE ?", "%."+k).
Updates(models.Heartbeat{Language: v})
if result.Error != nil {
log.Fatal(result.Error)
logbuch.Fatal(result.Error.Error())
}
if result.RowsAffected > 0 {
log.Printf("Migrated %+v rows for custom language %+s.\n", result.RowsAffected, k)
logbuch.Info("migrated %+v rows for custom language %+s", result.RowsAffected, k)
}
}
}