From b8c74e3abe5323f3c90081b9cf1b846cbafe4102 Mon Sep 17 00:00:00 2001 From: Hans Moog <3293976+hmoog@users.noreply.github.com> Date: Sun, 29 Oct 2023 11:01:56 +0100 Subject: [PATCH] Refactor: updated logging --- pkg/protocol/chain.go | 2 ++ pkg/protocol/chain_manager.go | 4 ++-- pkg/protocol/commitment.go | 3 --- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/protocol/chain.go b/pkg/protocol/chain.go index 68c2bc8d8..31071be9c 100644 --- a/pkg/protocol/chain.go +++ b/pkg/protocol/chain.go @@ -145,6 +145,8 @@ func NewChain(protocol *Protocol) *Chain { }) c.Logger = protocol.NewEntityLogger("Chain", c.IsEvicted, func(entityLogger log.Logger) { + entityLogger.LogDebug("created") + c.WarpSync.LogUpdates(entityLogger, log.LevelTrace, "WarpSync") c.NetworkClockSlot.LogUpdates(entityLogger, log.LevelTrace, "NetworkClockSlot") c.WarpSyncThreshold.LogUpdates(entityLogger, log.LevelTrace, "WarpSyncThreshold") diff --git a/pkg/protocol/chain_manager.go b/pkg/protocol/chain_manager.go index 5910232ab..5569620f7 100644 --- a/pkg/protocol/chain_manager.go +++ b/pkg/protocol/chain_manager.go @@ -89,7 +89,7 @@ func (c *ChainManager) PublishCommitment(commitment *model.Commitment) (commitme }) if published = commitmentMetadata == publishedCommitmentMetadata; published { - c.protocol.LogDebug("new commitment created", "name", commitmentMetadata.LogName(), "id", commitment.ID()) + commitmentMetadata.LogDebug("created", "id", commitment.ID()) } return commitmentMetadata, commitmentMetadata == publishedCommitmentMetadata, nil @@ -125,7 +125,7 @@ func (c *ChainManager) initMainChain() { mainChain := NewChain(c.protocol) - c.protocol.LogDebug("new chain created", "name", mainChain.LogName(), "forkingPoint", "") + //c.protocol.LogDebug("new chain created", "name", mainChain.LogName(), "forkingPoint", "") mainChain.VerifyState.Set(true) mainChain.Engine.OnUpdate(func(_, newEngine *engine.Engine) { c.protocol.Events.Engine.LinkTo(newEngine.Events) }) diff --git a/pkg/protocol/commitment.go b/pkg/protocol/commitment.go index 1fc50488a..84b5d451d 100644 --- a/pkg/protocol/commitment.go +++ b/pkg/protocol/commitment.go @@ -204,9 +204,6 @@ func (c *Commitment) inheritChain(parent *Commitment) func(*Commitment, *Commitm } spawnedChain = NewChain(c.protocol) - - c.protocol.LogDebug("new chain created", "name", spawnedChain.LogName(), "forkingPoint", c.LogName()) - spawnedChain.ForkingPoint.Set(c) }