From 65275b00d195501befd6d922a9f8a2360b57d17f Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 22 Mar 2024 16:29:29 +0100 Subject: [PATCH] Revise some log levels --- src/delegation_backend/aws_keyspaces.go | 10 +++++----- src/delegation_backend/submit.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/delegation_backend/aws_keyspaces.go b/src/delegation_backend/aws_keyspaces.go index 196d7e0..62ebc87 100644 --- a/src/delegation_backend/aws_keyspaces.go +++ b/src/delegation_backend/aws_keyspaces.go @@ -207,7 +207,7 @@ func calculateBlockSize(rawBlock []byte) int { func (kc *KeyspaceContext) insertSubmission(submission *Submission) error { return ExponentialBackoff(func() error { if submission.RawBlock != nil && calculateBlockSize(submission.RawBlock) > MAX_BLOCK_SIZE { - kc.Log.Warnf("KeyspaceSave: Block too large (%d bytes), inserting without raw_block", calculateBlockSize(submission.RawBlock)) + kc.Log.Infof("KeyspaceSave: Block too large (%d bytes), inserting without raw_block", calculateBlockSize(submission.RawBlock)) if err := kc.insertSubmissionWithoutRawBlock(submission); err != nil { return err } @@ -266,7 +266,7 @@ func (kc *KeyspaceContext) KeyspaceSave(objs ObjectsToSave) { if strings.HasPrefix(path, "submissions/") { submission, err := kc.parseSubmissionBytes(bs, path) if err != nil { - kc.Log.Warnf("KeyspaceSave: Error parsing submission JSON: %v", err) + kc.Log.Errorf("KeyspaceSave: Error parsing submission JSON: %v", err) continue } submissionToSave.BlockHash = submission.BlockHash @@ -283,17 +283,17 @@ func (kc *KeyspaceContext) KeyspaceSave(objs ObjectsToSave) { } else if strings.HasPrefix(path, "blocks/") { block, err := kc.parseBlockBytes(bs, path) if err != nil { - kc.Log.Warnf("KeyspaceSave: Error parsing block file: %v", err) + kc.Log.Errorf("KeyspaceSave: Error parsing block file: %v", err) continue } submissionToSave.RawBlock = block.RawBlock submissionToSave.BlockHash = block.BlockHash } else { - kc.Log.Warnf("KeyspaceSave: Unknown path format: %s", path) + kc.Log.Errorf("KeyspaceSave: Unknown path format: %s", path) } } - kc.Log.Debugf("KeyspaceSave: Saving submission for block: %v, submitter: %v, submitted_at: %v", submissionToSave.BlockHash, submissionToSave.Submitter, submissionToSave.SubmittedAt) + kc.Log.Infof("KeyspaceSave: Saving submission for block: %v, submitter: %v, submitted_at: %v", submissionToSave.BlockHash, submissionToSave.Submitter, submissionToSave.SubmittedAt) if err := kc.insertSubmission(submissionToSave); err != nil { kc.Log.Errorf("KeyspaceSave: Error saving submission to Keyspaces: %v", err) } diff --git a/src/delegation_backend/submit.go b/src/delegation_backend/submit.go index df94614..e38358e 100644 --- a/src/delegation_backend/submit.go +++ b/src/delegation_backend/submit.go @@ -51,7 +51,7 @@ func (ctx *AwsContext) S3Save(objs ObjectsToSave) { } } - ctx.Log.Debugf("S3Save: saving %s", path) + ctx.Log.Infof("S3Save: saving %s", path) _, err := ctx.Client.PutObject(ctx.Context, &s3.PutObjectInput{ Bucket: ctx.BucketName, Key: fullKey, @@ -76,10 +76,10 @@ func LocalFileSystemSave(objs ObjectsToSave, directory string, log logging.Stand err := os.MkdirAll(filepath.Dir(fullPath), os.ModePerm) if err != nil { - log.Warnf("LocalFileSystemSave: Error creating directories for %s: %v", fullPath, err) + log.Errorf("LocalFileSystemSave: Error creating directories for %s: %v", fullPath, err) continue // skip to the next object } - log.Debugf("LocalFileSystemSave: saving %s", fullPath) + log.Infof("LocalFileSystemSave: saving %s", fullPath) err = os.WriteFile(fullPath, bs, 0644) if err != nil { log.Warnf("Error writing to file %s: %v", fullPath, err)