From 8effc77788a201efe87636c94e16436da26b5199 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 17 Sep 2024 19:35:47 +0000 Subject: [chore] improved federatingdb logging in cases of unknown iri / types (#3313) * improved federatingdb logging in cases of unknown iri / types, add new log methods * whoops; forgot to wrap log argument in serialize{} ! * use debug instead of warn level * switch last entry to Debug --- internal/federation/federatingdb/create.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'internal/federation/federatingdb/create.go') diff --git a/internal/federation/federatingdb/create.go b/internal/federation/federatingdb/create.go index 44f3cd98c..2a780ed7c 100644 --- a/internal/federation/federatingdb/create.go +++ b/internal/federation/federatingdb/create.go @@ -22,7 +22,6 @@ import ( "errors" "fmt" - "codeberg.org/gruf/go-logger/v2/level" "github.com/miekg/dns" "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" @@ -48,17 +47,7 @@ import ( // Under certain conditions and network activities, Create may be called // multiple times for the same ActivityStreams object. func (f *federatingDB) Create(ctx context.Context, asType vocab.Type) error { - if log.Level() >= level.TRACE { - i, err := marshalItem(asType) - if err != nil { - return err - } - - log. - WithContext(ctx). - WithField("create", i). - Trace("entering Create") - } + log.DebugKV(ctx, "create", serialize{asType}) activityContext := getActivityContext(ctx) if activityContext.internal { @@ -74,7 +63,7 @@ func (f *federatingDB) Create(ctx context.Context, asType vocab.Type) error { return nil } - switch asType.GetTypeName() { + switch name := asType.GetTypeName(); name { case ap.ActivityBlock: // BLOCK SOMETHING return f.activityBlock(ctx, asType, receivingAcct, requestingAcct) @@ -90,6 +79,8 @@ func (f *federatingDB) Create(ctx context.Context, asType vocab.Type) error { case ap.ActivityFlag: // FLAG / REPORT SOMETHING return f.activityFlag(ctx, asType, receivingAcct, requestingAcct) + default: + log.Debugf(ctx, "unhandled object type: %s", name) } return nil -- cgit v1.2.3