photoprism/internal/query/errors.go
Michael Mayer d1db3d04f7 Logs: Improve event log and messages in i18n package
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-07-07 10:51:55 +02:00

22 lines
471 B
Go

package query
import (
"strings"
"github.com/photoprism/photoprism/internal/entity"
)
// Errors returns the error log filtered with an optional search string.
func Errors(limit, offset int, s string) (results entity.Errors, err error) {
stmt := Db()
s = strings.TrimSpace(s)
if len(s) >= 3 {
stmt = stmt.Where("error_message LIKE ?", "%"+s+"%")
}
err = stmt.Order("error_time DESC").Limit(limit).Offset(offset).Find(&results).Error
return results, err
}