summaryrefslogtreecommitdiff
path: root/internal/typeutils/internaltofrontend.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-07-19 09:47:55 +0100
committerLibravatar GitHub <noreply@github.com>2022-07-19 10:47:55 +0200
commit098dbe6ff4f59652181c8e0e3873fbfcf0e65ea3 (patch)
tree17036ad9db68c3080e1e91279c8bce9f9ea6e5c3 /internal/typeutils/internaltofrontend.go
parent[bugfix] Markdown format fixes (#718) (diff)
downloadgotosocial-098dbe6ff4f59652181c8e0e3873fbfcf0e65ea3.tar.xz
[chore] use our own logging implementation (#716)
* first commit Signed-off-by: kim <grufwub@gmail.com> * replace logging with our own log library Signed-off-by: kim <grufwub@gmail.com> * fix imports Signed-off-by: kim <grufwub@gmail.com> * fix log imports Signed-off-by: kim <grufwub@gmail.com> * add license text Signed-off-by: kim <grufwub@gmail.com> * fix package import cycle between config and log package Signed-off-by: kim <grufwub@gmail.com> * fix empty kv.Fields{} being passed to WithFields() Signed-off-by: kim <grufwub@gmail.com> * fix uses of log.WithFields() with whitespace issues and empty slices Signed-off-by: kim <grufwub@gmail.com> * *linter related grumbling* Signed-off-by: kim <grufwub@gmail.com> * gofmt the codebase! also fix more log.WithFields() formatting issues Signed-off-by: kim <grufwub@gmail.com> * update testrig code to match new changes Signed-off-by: kim <grufwub@gmail.com> * fix error wrapping in non fmt.Errorf function Signed-off-by: kim <grufwub@gmail.com> * add benchmarking of log.Caller() vs non-cached Signed-off-by: kim <grufwub@gmail.com> * fix syslog tests, add standard build tags to test runner to ensure consistency Signed-off-by: kim <grufwub@gmail.com> * make syslog tests more robust Signed-off-by: kim <grufwub@gmail.com> * fix caller depth arithmatic (is that how you spell it?) Signed-off-by: kim <grufwub@gmail.com> * update to use unkeyed fields in kv.Field{} instances Signed-off-by: kim <grufwub@gmail.com> * update go-kv library Signed-off-by: kim <grufwub@gmail.com> * update libraries list Signed-off-by: kim <grufwub@gmail.com> * fuck you linter get nerfed Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Diffstat (limited to 'internal/typeutils/internaltofrontend.go')
-rw-r--r--internal/typeutils/internaltofrontend.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index 138b85553..1ac49688a 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -23,12 +23,11 @@ import (
"fmt"
"strings"
- "github.com/sirupsen/logrus"
-
"github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
+ "github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/internal/media"
"github.com/superseriousbusiness/gotosocial/internal/util"
)
@@ -105,7 +104,7 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
if err == nil {
a.AvatarMediaAttachment = avi
} else {
- logrus.Errorf("AccountToAPIAccountPublic: error getting Avatar with id %s: %s", a.AvatarMediaAttachmentID, err)
+ log.Errorf("AccountToAPIAccountPublic: error getting Avatar with id %s: %s", a.AvatarMediaAttachmentID, err)
}
}
if a.AvatarMediaAttachment != nil {
@@ -123,7 +122,7 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
if err == nil {
a.HeaderMediaAttachment = avi
} else {
- logrus.Errorf("AccountToAPIAccountPublic: error getting Header with id %s: %s", a.HeaderMediaAttachmentID, err)
+ log.Errorf("AccountToAPIAccountPublic: error getting Header with id %s: %s", a.HeaderMediaAttachmentID, err)
}
}
if a.HeaderMediaAttachment != nil {
@@ -388,7 +387,7 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
for _, gtsAttachment := range s.Attachments {
apiAttachment, err := c.AttachmentToAPIAttachment(ctx, gtsAttachment)
if err != nil {
- logrus.Errorf("error converting attachment with id %s: %s", gtsAttachment.ID, err)
+ log.Errorf("error converting attachment with id %s: %s", gtsAttachment.ID, err)
continue
}
apiAttachments = append(apiAttachments, apiAttachment)
@@ -399,12 +398,12 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
for _, aID := range s.AttachmentIDs {
gtsAttachment, err := c.db.GetAttachmentByID(ctx, aID)
if err != nil {
- logrus.Errorf("error getting attachment with id %s: %s", aID, err)
+ log.Errorf("error getting attachment with id %s: %s", aID, err)
continue
}
apiAttachment, err := c.AttachmentToAPIAttachment(ctx, gtsAttachment)
if err != nil {
- logrus.Errorf("error converting attachment with id %s: %s", aID, err)
+ log.Errorf("error converting attachment with id %s: %s", aID, err)
continue
}
apiAttachments = append(apiAttachments, apiAttachment)
@@ -418,7 +417,7 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
for _, gtsMention := range s.Mentions {
apiMention, err := c.MentionToAPIMention(ctx, gtsMention)
if err != nil {
- logrus.Errorf("error converting mention with id %s: %s", gtsMention.ID, err)
+ log.Errorf("error converting mention with id %s: %s", gtsMention.ID, err)
continue
}
apiMentions = append(apiMentions, apiMention)
@@ -429,12 +428,12 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
for _, mID := range s.MentionIDs {
gtsMention, err := c.db.GetMention(ctx, mID)
if err != nil {
- logrus.Errorf("error getting mention with id %s: %s", mID, err)
+ log.Errorf("error getting mention with id %s: %s", mID, err)
continue
}
apiMention, err := c.MentionToAPIMention(ctx, gtsMention)
if err != nil {
- logrus.Errorf("error converting mention with id %s: %s", gtsMention.ID, err)
+ log.Errorf("error converting mention with id %s: %s", gtsMention.ID, err)
continue
}
apiMentions = append(apiMentions, apiMention)
@@ -448,7 +447,7 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
for _, gtsTag := range s.Tags {
apiTag, err := c.TagToAPITag(ctx, gtsTag)
if err != nil {
- logrus.Errorf("error converting tag with id %s: %s", gtsTag.ID, err)
+ log.Errorf("error converting tag with id %s: %s", gtsTag.ID, err)
continue
}
apiTags = append(apiTags, apiTag)
@@ -459,12 +458,12 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
for _, t := range s.TagIDs {
gtsTag := &gtsmodel.Tag{}
if err := c.db.GetByID(ctx, t, gtsTag); err != nil {
- logrus.Errorf("error getting tag with id %s: %s", t, err)
+ log.Errorf("error getting tag with id %s: %s", t, err)
continue
}
apiTag, err := c.TagToAPITag(ctx, gtsTag)
if err != nil {
- logrus.Errorf("error converting tag with id %s: %s", gtsTag.ID, err)
+ log.Errorf("error converting tag with id %s: %s", gtsTag.ID, err)
continue
}
apiTags = append(apiTags, apiTag)
@@ -478,7 +477,7 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
for _, gtsEmoji := range s.Emojis {
apiEmoji, err := c.EmojiToAPIEmoji(ctx, gtsEmoji)
if err != nil {
- logrus.Errorf("error converting emoji with id %s: %s", gtsEmoji.ID, err)
+ log.Errorf("error converting emoji with id %s: %s", gtsEmoji.ID, err)
continue
}
apiEmojis = append(apiEmojis, apiEmoji)
@@ -489,12 +488,12 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
for _, e := range s.EmojiIDs {
gtsEmoji := &gtsmodel.Emoji{}
if err := c.db.GetByID(ctx, e, gtsEmoji); err != nil {
- logrus.Errorf("error getting emoji with id %s: %s", e, err)
+ log.Errorf("error getting emoji with id %s: %s", e, err)
continue
}
apiEmoji, err := c.EmojiToAPIEmoji(ctx, gtsEmoji)
if err != nil {
- logrus.Errorf("error converting emoji with id %s: %s", gtsEmoji.ID, err)
+ log.Errorf("error converting emoji with id %s: %s", gtsEmoji.ID, err)
continue
}
apiEmojis = append(apiEmojis, apiEmoji)