fix:#3 added error key in slog

This commit is contained in:
Elmar Kresse
2024-05-26 22:47:32 +02:00
parent 1bac9bf187
commit 1267b37ab6
3 changed files with 7 additions and 6 deletions

View File

@ -45,7 +45,7 @@ func ClearFeeds(db *daos.Dao, months int, clock localTime.Clock) {
sqlResult, err = db.DB().Delete("feeds", dbx.NewExp("id = {:id}", dbx.Params{"id": feed.GetId()})).Execute()
if err != nil {
slog.Error("CleanFeeds: delete feed "+feed.GetId()+" failed", "error", err)
slog.Error("SQL Result: ", sqlResult)
slog.Error("SQL Result: ", "error", sqlResult)
} else {
slog.Info("CleanFeeds: delete feed " + feed.GetId() + " successful")
}

View File

@ -233,9 +233,10 @@ func getWeekEvents(start time.Time, end time.Time, cycle string) ([]time.Time, [
endI, endIErr = getDayInt(days[1])
if endIErr != nil || startIErr != nil {
slog.Error("Error while getting day int: "+days[0]+" - "+days[1]+" :", startIErr, endIErr)
slog.Error("Error while getting day int: "+days[0]+" - "+days[1]+" :", "error", startIErr)
slog.Error("Error while getting day int endErr: ", "error", endIErr)
} else {
//create a int array with all days from start to end day
//create an int array with all days from start to end day
var daysBetween []int
for i := startI; i <= endI; i++ {
daysBetween = append(daysBetween, i)
@ -442,7 +443,7 @@ func htmlRequest(url string) (*goquery.Document, error) {
defer func(Body io.ReadCloser) {
readErr := Body.Close()
if readErr != nil {
slog.Error("Error while closing response body from html request", readErr)
slog.Error("Error while closing response body from html request", "error", readErr)
return
}
}(resp.Body)

View File

@ -81,14 +81,14 @@ func FetchSeminarGroups(app *pocketbase.PocketBase) ([]*models.Record, error) {
collection, dbError := db.FindCollection(app, "groups")
if dbError != nil {
slog.Error("Error while searching collection groups", dbError)
slog.Error("Error while searching collection groups", "error", dbError)
return nil, err
}
var insertedGroups []*models.Record
insertedGroups, dbError = db.SaveGroups(groups, collection, app)
if dbError != nil {
slog.Error("Error while saving groups", dbError)
slog.Error("Error while saving groups", "error", dbError)
return nil, err
}