Improve logging

This commit is contained in:
speatzle 2024-05-10 13:28:11 +02:00
parent d9f2da2519
commit af88c101a7

View file

@ -140,7 +140,7 @@ func scan(ctx context.Context, id string) {
slog.InfoContext(ctx, "File is New", "path", path)
_, err = tx.Exec(ctx, "INSERT INTO files (library_id, path, size, missing) VALUES ($1, $2, $3, $4)", id, path, info.Size(), false)
if err != nil {
return fmt.Errorf("Creating New File: %w", err)
return fmt.Errorf("Add New File to DB: %w", err)
}
return nil
} else if err != nil {
@ -149,7 +149,7 @@ func scan(ctx context.Context, id string) {
// File Exists so update Size and missing Status
_, err = tx.Exec(ctx, "UPDATE files SET size = $1, missing = $2 WHERE id = $3", info.Size(), false, fileID)
if err != nil {
return fmt.Errorf("Creating New File: %w", err)
return fmt.Errorf("Updating File in DB: %w", err)
}
return nil
})