Skip to content

Commit

Permalink
Revise some log levels
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-iohk committed Mar 22, 2024
1 parent e3dbec7 commit 65275b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/delegation_backend/aws_keyspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions src/delegation_backend/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 65275b0

Please sign in to comment.