diff options
Diffstat (limited to 'internal/federation/federatingdb')
| -rw-r--r-- | internal/federation/federatingdb/create.go | 14 | ||||
| -rw-r--r-- | internal/federation/federatingdb/delete.go | 7 | ||||
| -rw-r--r-- | internal/federation/federatingdb/exists.go | 9 | ||||
| -rw-r--r-- | internal/federation/federatingdb/followers.go | 7 | ||||
| -rw-r--r-- | internal/federation/federatingdb/following.go | 7 | ||||
| -rw-r--r-- | internal/federation/federatingdb/get.go | 3 | ||||
| -rw-r--r-- | internal/federation/federatingdb/owns.go | 7 | ||||
| -rw-r--r-- | internal/federation/federatingdb/util.go | 4 | 
8 files changed, 33 insertions, 25 deletions
| diff --git a/internal/federation/federatingdb/create.go b/internal/federation/federatingdb/create.go index 62784e68d..bf3e7f75d 100644 --- a/internal/federation/federatingdb/create.go +++ b/internal/federation/federatingdb/create.go @@ -53,8 +53,9 @@ func (f *federatingDB) Create(ctx context.Context, asType vocab.Type) error {  		if err != nil {  			return err  		} -		l := log.WithField("create", i) -		l.Debug("entering Create") +		l := log.WithContext(ctx). +			WithField("create", i) +		l.Trace("entering Create")  	}  	receivingAccount, requestingAccount := extractFromCtx(ctx) @@ -164,10 +165,11 @@ func (f *federatingDB) activityCreate(ctx context.Context, asType vocab.Type, re  // createNote handles a Create activity with a Note type.  func (f *federatingDB) createNote(ctx context.Context, note vocab.ActivityStreamsNote, receivingAccount *gtsmodel.Account, requestingAccount *gtsmodel.Account) error { -	l := log.WithFields(kv.Fields{ -		{"receivingAccount", receivingAccount.URI}, -		{"requestingAccount", requestingAccount.URI}, -	}...) +	l := log.WithContext(ctx). +		WithFields(kv.Fields{ +			{"receivingAccount", receivingAccount.URI}, +			{"requestingAccount", requestingAccount.URI}, +		}...)  	// Check if we have a forward.  	// In other words, was the note posted to our inbox by at least one actor who actually created the note, or are they just forwarding it? diff --git a/internal/federation/federatingdb/delete.go b/internal/federation/federatingdb/delete.go index 22434f63e..a1890b56b 100644 --- a/internal/federation/federatingdb/delete.go +++ b/internal/federation/federatingdb/delete.go @@ -35,9 +35,10 @@ import (  //  // The library makes this call only after acquiring a lock first.  func (f *federatingDB) Delete(ctx context.Context, id *url.URL) error { -	l := log.WithFields(kv.Fields{ -		{"id", id}, -	}...) +	l := log.WithContext(ctx). +		WithFields(kv.Fields{ +			{"id", id}, +		}...)  	l.Debug("entering Delete")  	receivingAccount, requestingAccount := extractFromCtx(ctx) diff --git a/internal/federation/federatingdb/exists.go b/internal/federation/federatingdb/exists.go index 51e7399aa..a235770c6 100644 --- a/internal/federation/federatingdb/exists.go +++ b/internal/federation/federatingdb/exists.go @@ -32,10 +32,11 @@ import (  // The library makes this call only after acquiring a lock first.  //  // Implementation note: this just straight up isn't implemented, and doesn't *really* need to be either. -func (f *federatingDB) Exists(c context.Context, id *url.URL) (exists bool, err error) { -	l := log.WithFields(kv.Fields{ -		{"id", id}, -	}...) +func (f *federatingDB) Exists(ctx context.Context, id *url.URL) (exists bool, err error) { +	l := log.WithContext(ctx). +		WithFields(kv.Fields{ +			{"id", id}, +		}...)  	l.Debug("entering Exists")  	return false, nil  } diff --git a/internal/federation/federatingdb/followers.go b/internal/federation/federatingdb/followers.go index 9a80d5f0b..c47a2b625 100644 --- a/internal/federation/federatingdb/followers.go +++ b/internal/federation/federatingdb/followers.go @@ -18,9 +18,10 @@ import (  //  // The library makes this call only after acquiring a lock first.  func (f *federatingDB) Followers(ctx context.Context, actorIRI *url.URL) (followers vocab.ActivityStreamsCollection, err error) { -	l := log.WithFields(kv.Fields{ -		{"id", actorIRI}, -	}...) +	l := log.WithContext(ctx). +		WithFields(kv.Fields{ +			{"id", actorIRI}, +		}...)  	l.Debug("entering Followers")  	acct, err := f.getAccountForIRI(ctx, actorIRI) diff --git a/internal/federation/federatingdb/following.go b/internal/federation/federatingdb/following.go index 2290b72f4..f4f07bb25 100644 --- a/internal/federation/federatingdb/following.go +++ b/internal/federation/federatingdb/following.go @@ -36,9 +36,10 @@ import (  //  // The library makes this call only after acquiring a lock first.  func (f *federatingDB) Following(ctx context.Context, actorIRI *url.URL) (following vocab.ActivityStreamsCollection, err error) { -	l := log.WithFields(kv.Fields{ -		{"id", actorIRI}, -	}...) +	l := log.WithContext(ctx). +		WithFields(kv.Fields{ +			{"id", actorIRI}, +		}...)  	l.Debug("entering Following")  	acct, err := f.getAccountForIRI(ctx, actorIRI) diff --git a/internal/federation/federatingdb/get.go b/internal/federation/federatingdb/get.go index a55cb0280..92a79d70f 100644 --- a/internal/federation/federatingdb/get.go +++ b/internal/federation/federatingdb/get.go @@ -33,7 +33,8 @@ import (  //  // The library makes this call only after acquiring a lock first.  func (f *federatingDB) Get(ctx context.Context, id *url.URL) (value vocab.Type, err error) { -	l := log.WithFields(kv.Fields{{"id", id}}...) +	l := log.WithContext(ctx). +		WithFields(kv.Fields{{"id", id}}...)  	l.Debug("entering Get")  	switch { diff --git a/internal/federation/federatingdb/owns.go b/internal/federation/federatingdb/owns.go index 070036df7..def0fa518 100644 --- a/internal/federation/federatingdb/owns.go +++ b/internal/federation/federatingdb/owns.go @@ -35,9 +35,10 @@ import (  // the database has an entry for the IRI.  // The library makes this call only after acquiring a lock first.  func (f *federatingDB) Owns(ctx context.Context, id *url.URL) (bool, error) { -	l := log.WithFields(kv.Fields{ -		{"id", id}, -	}...) +	l := log.WithContext(ctx). +		WithFields(kv.Fields{ +			{"id", id}, +		}...)  	l.Debug("entering Owns")  	// if the id host isn't this instance host, we don't own this IRI diff --git a/internal/federation/federatingdb/util.go b/internal/federation/federatingdb/util.go index b5a9feab1..1eb27dc03 100644 --- a/internal/federation/federatingdb/util.go +++ b/internal/federation/federatingdb/util.go @@ -304,7 +304,7 @@ func extractFromCtx(ctx context.Context) (receivingAccount, requestingAccount *g  		var ok bool  		receivingAccount, ok = receivingAccountI.(*gtsmodel.Account)  		if !ok { -			log.Panicf("extractFromCtx: context entry with key %s could not be asserted to *gtsmodel.Account", ap.ContextReceivingAccount) +			log.Panicf(ctx, "context entry with key %s could not be asserted to *gtsmodel.Account", ap.ContextReceivingAccount)  		}  	} @@ -313,7 +313,7 @@ func extractFromCtx(ctx context.Context) (receivingAccount, requestingAccount *g  		var ok bool  		requestingAccount, ok = requestingAcctI.(*gtsmodel.Account)  		if !ok { -			log.Panicf("extractFromCtx: context entry with key %s could not be asserted to *gtsmodel.Account", ap.ContextRequestingAccount) +			log.Panicf(ctx, "context entry with key %s could not be asserted to *gtsmodel.Account", ap.ContextRequestingAccount)  		}  	} | 
