summaryrefslogtreecommitdiff
path: root/internal/federation/federatingdb/create.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-09-17 19:35:47 +0000
committerLibravatar GitHub <noreply@github.com>2024-09-17 21:35:47 +0200
commit8effc77788a201efe87636c94e16436da26b5199 (patch)
treea848340e71b2bd9a48c45c6d3376b9b0486eb98f /internal/federation/federatingdb/create.go
parent[bugfix] Fix pending approval check (#3316) (diff)
downloadgotosocial-8effc77788a201efe87636c94e16436da26b5199.tar.xz
[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
Diffstat (limited to 'internal/federation/federatingdb/create.go')
-rw-r--r--internal/federation/federatingdb/create.go17
1 files changed, 4 insertions, 13 deletions
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