mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
Replaced ImportResult.ImportErrors with ImportResult.ImportLog
This commit is contained in:
parent
91f9b62db3
commit
8a2ddb7772
5 changed files with 55 additions and 13 deletions
|
@ -164,11 +164,24 @@ type ListensResult ExportResult[ListensList]
|
|||
|
||||
type LovesResult ExportResult[LovesList]
|
||||
|
||||
type LogEntryType string
|
||||
|
||||
const (
|
||||
Info LogEntryType = "Info"
|
||||
Warning LogEntryType = "Warning"
|
||||
Error LogEntryType = "Error"
|
||||
)
|
||||
|
||||
type LogEntry struct {
|
||||
Type LogEntryType
|
||||
Message string
|
||||
}
|
||||
|
||||
type ImportResult struct {
|
||||
TotalCount int
|
||||
ImportCount int
|
||||
LastTimestamp time.Time
|
||||
ImportErrors []string
|
||||
ImportLog []LogEntry
|
||||
|
||||
// Error is only set if an unrecoverable import error occurred
|
||||
Error error
|
||||
|
@ -185,7 +198,14 @@ func (i *ImportResult) Update(from ImportResult) {
|
|||
i.TotalCount = from.TotalCount
|
||||
i.ImportCount = from.ImportCount
|
||||
i.UpdateTimestamp(from.LastTimestamp)
|
||||
i.ImportErrors = append(i.ImportErrors, from.ImportErrors...)
|
||||
i.ImportLog = append(i.ImportLog, from.ImportLog...)
|
||||
}
|
||||
|
||||
func (i *ImportResult) Log(t LogEntryType, msg string) {
|
||||
i.ImportLog = append(i.ImportLog, LogEntry{
|
||||
Type: t,
|
||||
Message: msg,
|
||||
})
|
||||
}
|
||||
|
||||
type Progress struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue