Better tracing

Not done yet, still need to add them to just about every other function
This commit is contained in:
Melody Becker 2024-11-06 16:57:44 +01:00
parent 83f47d17be
commit 529d106351
13 changed files with 148 additions and 22 deletions

View file

@ -3,6 +3,8 @@ package storage
import (
"time"
"github.com/rs/zerolog/log"
"gitlab.com/mstarongitlab/linstrom/util"
"gorm.io/gorm"
)
@ -22,6 +24,7 @@ type UserInfoField struct {
// TODO: Add functions to store, load, update and delete these
func (s *Storage) FindUserFieldById(id uint) (*UserInfoField, error) {
defer util.Untrace(util.Trace(&log.Logger))
entry := UserInfoField{}
err := s.db.First(&entry, id).Error
switch err {
@ -35,6 +38,7 @@ func (s *Storage) FindUserFieldById(id uint) (*UserInfoField, error) {
}
func (s *Storage) FindMultipleUserFieldsById(ids []uint) ([]UserInfoField, error) {
defer util.Untrace(util.Trace(&log.Logger))
entries := []UserInfoField{}
err := s.db.Where(ids).Find(&entries).Error
switch err {