diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-02 00:43:27 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-02 00:43:27 +0000 |
commit | 8bd180f221e1a767934de81dbd99fbfadccc7a93 (patch) | |
tree | 918da21f31494870a3258ff15fa65a1e01cdecbc /models/persister.go | |
parent | a69f9cfc6ba6ff332d1e2d8303020d49443ca8cb (diff) | |
download | communique-8bd180f221e1a767934de81dbd99fbfadccc7a93.tar.gz |
logging cleanup
Diffstat (limited to 'models/persister.go')
-rw-r--r-- | models/persister.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/models/persister.go b/models/persister.go index 60c25b5..4381008 100644 --- a/models/persister.go +++ b/models/persister.go @@ -22,20 +22,20 @@ func NewPersister(log *zap.SugaredLogger, db *badger.DB) *Persister { } func (p *Persister) Store(model model) error { - log := p.log.With("model", model.Name()) - log.Debug("store") + log := p.log.With("model", model.Name()).With("DedupKey", model.DedupKey()).With("Key", model.Key()) + log.Debug("Store()") err := p.db.View(func(txn *badger.Txn) error { var getErr error var updateErr error - log.With("DedupKey", model.DedupKey()).Debug("checking") + log.Debug("checking") _, getErr = txn.Get([]byte(model.DedupKey())) if getErr == badger.ErrKeyNotFound { - log.With("DedupKey", model.DedupKey()).Debug("not found") + log.Debug("not found") updateErr = p.db.Update(model.Save) // stores the outbox item if updateErr != nil { return updateErr } - log.With("DedupKey", model.DedupKey()).Debug("saving") + log.Debug("saving") updateErr = p.db.Update(model.SaveDedup) // stores the sha256 } return updateErr |