summaryrefslogtreecommitdiff
path: root/internal/media/processingmedia.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/media/processingmedia.go')
-rw-r--r--internal/media/processingmedia.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/internal/media/processingmedia.go b/internal/media/processingmedia.go
index 17fddddb7..885e97417 100644
--- a/internal/media/processingmedia.go
+++ b/internal/media/processingmedia.go
@@ -28,11 +28,11 @@ import (
"sync/atomic"
"time"
- "github.com/sirupsen/logrus"
terminator "github.com/superseriousbusiness/exif-terminator"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id"
+ "github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/internal/storage"
"github.com/superseriousbusiness/gotosocial/internal/uris"
)
@@ -80,10 +80,10 @@ func (p *ProcessingMedia) AttachmentID() string {
// LoadAttachment blocks until the thumbnail and fullsize content
// has been processed, and then returns the completed attachment.
func (p *ProcessingMedia) LoadAttachment(ctx context.Context) (*gtsmodel.MediaAttachment, error) {
- logrus.Tracef("LoadAttachment: getting lock for attachment %s", p.attachment.URL)
+ log.Tracef("LoadAttachment: getting lock for attachment %s", p.attachment.URL)
p.mu.Lock()
defer p.mu.Unlock()
- logrus.Tracef("LoadAttachment: got lock for attachment %s", p.attachment.URL)
+ log.Tracef("LoadAttachment: got lock for attachment %s", p.attachment.URL)
if err := p.store(ctx); err != nil {
return nil, err
@@ -113,7 +113,7 @@ func (p *ProcessingMedia) LoadAttachment(ctx context.Context) (*gtsmodel.MediaAt
p.insertedInDB = true
}
- logrus.Tracef("LoadAttachment: finished, returning attachment %s", p.attachment.URL)
+ log.Tracef("LoadAttachment: finished, returning attachment %s", p.attachment.URL)
return p.attachment, nil
}
@@ -137,7 +137,7 @@ func (p *ProcessingMedia) loadThumb(ctx context.Context) error {
}
// stream the original file out of storage
- logrus.Tracef("loadThumb: fetching attachment from storage %s", p.attachment.URL)
+ log.Tracef("loadThumb: fetching attachment from storage %s", p.attachment.URL)
stored, err := p.storage.GetStream(ctx, p.attachment.File.Path)
if err != nil {
p.err = fmt.Errorf("loadThumb: error fetching file from storage: %s", err)
@@ -147,14 +147,14 @@ func (p *ProcessingMedia) loadThumb(ctx context.Context) error {
// whatever happens, close the stream when we're done
defer func() {
- logrus.Tracef("loadThumb: closing stored stream %s", p.attachment.URL)
+ log.Tracef("loadThumb: closing stored stream %s", p.attachment.URL)
if err := stored.Close(); err != nil {
- logrus.Errorf("loadThumb: error closing stored full size: %s", err)
+ log.Errorf("loadThumb: error closing stored full size: %s", err)
}
}()
// stream the file from storage straight into the derive thumbnail function
- logrus.Tracef("loadThumb: calling deriveThumbnail %s", p.attachment.URL)
+ log.Tracef("loadThumb: calling deriveThumbnail %s", p.attachment.URL)
thumb, err := deriveThumbnail(stored, p.attachment.File.ContentType, createBlurhash)
if err != nil {
p.err = fmt.Errorf("loadThumb: error deriving thumbnail: %s", err)
@@ -163,7 +163,7 @@ func (p *ProcessingMedia) loadThumb(ctx context.Context) error {
}
// put the thumbnail in storage
- logrus.Tracef("loadThumb: storing new thumbnail %s", p.attachment.URL)
+ log.Tracef("loadThumb: storing new thumbnail %s", p.attachment.URL)
if err := p.storage.Put(ctx, p.attachment.Thumbnail.Path, thumb.small); err != nil {
p.err = fmt.Errorf("loadThumb: error storing thumbnail: %s", err)
atomic.StoreInt32(&p.thumbState, int32(errored))
@@ -184,7 +184,7 @@ func (p *ProcessingMedia) loadThumb(ctx context.Context) error {
// we're done processing the thumbnail!
atomic.StoreInt32(&p.thumbState, int32(complete))
- logrus.Tracef("loadThumb: finished processing thumbnail for attachment %s", p.attachment.URL)
+ log.Tracef("loadThumb: finished processing thumbnail for attachment %s", p.attachment.URL)
fallthrough
case complete:
return nil
@@ -245,7 +245,7 @@ func (p *ProcessingMedia) loadFullSize(ctx context.Context) error {
// we're done processing the full-size image
atomic.StoreInt32(&p.fullSizeState, int32(complete))
- logrus.Tracef("loadFullSize: finished processing full size image for attachment %s", p.attachment.URL)
+ log.Tracef("loadFullSize: finished processing full size image for attachment %s", p.attachment.URL)
fallthrough
case complete:
return nil
@@ -270,13 +270,13 @@ func (p *ProcessingMedia) store(ctx context.Context) error {
if err != nil {
return fmt.Errorf("store: error executing data function: %s", err)
}
- logrus.Tracef("store: reading %d bytes from data function for media %s", fileSize, p.attachment.URL)
+ log.Tracef("store: reading %d bytes from data function for media %s", fileSize, p.attachment.URL)
// defer closing the reader when we're done with it
defer func() {
if rc, ok := reader.(io.ReadCloser); ok {
if err := rc.Close(); err != nil {
- logrus.Errorf("store: error closing readcloser: %s", err)
+ log.Errorf("store: error closing readcloser: %s", err)
}
}
}()
@@ -330,7 +330,7 @@ func (p *ProcessingMedia) store(ctx context.Context) error {
defer func() {
if rc, ok := clean.(io.ReadCloser); ok {
if err := rc.Close(); err != nil {
- logrus.Errorf("store: error closing clean readcloser: %s", err)
+ log.Errorf("store: error closing clean readcloser: %s", err)
}
}
}()
@@ -353,7 +353,7 @@ func (p *ProcessingMedia) store(ctx context.Context) error {
return p.postData(ctx)
}
- logrus.Tracef("store: finished storing initial data for attachment %s", p.attachment.URL)
+ log.Tracef("store: finished storing initial data for attachment %s", p.attachment.URL)
return nil
}